NoMethodError: undefined method `to_xml' for #Cleo::Result:0x007fb21389c110
module Cleo
class Result
include HappyMapper
tag 'element'
has_many :term, String, :tag => 'term'
element :id, Integer
element :name, String
element :score, Float
element :timestamp, Time
element :title, String
element :url, String
alias :terms :term
end
end
When methods is called on the object c = Cleo::Result:0x007fb21389c110
1.9.2p318 :011 > c.methods
=> [:!, :!=, :!, :<=>, :==, :===, :=, :JSON, :id, :send, :`, :acts_like?, :as_json, :binding_n, :blank?, :breakpoint, :capture, :class, :class_eval, :clone, :dclone, :debugger, :define_singleton_method, :display, :dup, :duplicable?, :enable_warnings, :enum_for, :eql?, :equal?, :extend, :freeze, :frozen?, :gem, :hash, :html_safe?, :id, :id=, :in?, :initialize_clone, :initialize_dup, :inspect, :instance_eval, :instance_exec, :instance_of?, :instance_values, :instance_variable_defined?, :instance_variable_get, :instance_variable_names, :instance_variable_set, :instance_variables, :is_a?, :is_haml?, :j, :jj, :kind_of?, :load, :load_dependency, :method, :methods, :name, :name=, :nil?, :object_id, :presence, :present?, :pretty_inspect, :pretty_print, :pretty_print_cycle, :pretty_print_inspect, :pretty_print_instance_variables, :private_methods, :protected_methods, :psych_to_yaml, :psych_y, :public_method, :public_methods, :public_send, :quietly, :require, :require_association, :require_dependency, :require_library_or_gem, :require_library_or_gem_with_deprecation, :require_library_or_gem_without_deprecation, :require_or_load, :respond_to?, :respond_to_missing?, :score, :score=, :send, :silence, :silence_stderr, :silence_stream, :silence_warnings, :singleton_class, :singleton_methods, :suppress, :suppress_warnings, :taint, :tainted?, :tap, :term, :term=, :terms, :timestamp, :timestamp=, :title, :title=, :to_enum, :to_json, :to_param, :to_query, :to_s, :to_yaml, :to_yaml_properties, :trust, :try, :unloadable, :untaint, :untrust, :untrusted?, :url, :url=, :with_options, :with_warnings, :y]
and sure enough there is no to_xml listed in the methods call. I was thinking that to_xml should be an instance method and not a class method.
https://github.com/dam5s/happymapper/blob/master/lib/happymapper.rb#L346
I could be wrong. I have been looking at xml files for 3 days.
--Cheers.