lib/muxml/base.rb
def method_missing(sym, *args, &block)
      if sym.to_s.start_with?('attribute_')
        attribute = sym.to_s.sub(/^attribute_/, '')
        return @xml.attributes[attribute]
      elsif @@relations.has_key?(self.class)
        if @@relations[self.class][:many].has_key?(sym)
          return Relation::Many.new(self, sym, @@relations[self.class][:many][sym].dup)
        elsif @@relations[self.class][:one].has_key?(sym)
          return Relation::One.new(self, sym, @@relations[self.class][:one][sym].dup)
        end
      end
      raise NoMethodError, "undefined method `#{sym}' for #{self}"
    end
# for call attributes of xml just prefix with *attribute_*
for call attributes of xml just prefix with *attribute_
for call attributes of xml just prefix with * attribute_
def method_missing(sym, *args, &block)
      if sym.to_s.start_with?('attribute_')
        attribute = sym.to_s.sub(/^attribute_/, '')
        return @xml.attributes[attribute]
      elsif @@relations.has_key?(self.class)
        if @@relations[self.class][:many].has_key?(sym)
          return Relation::Many.new(self, sym, @@relations[self.class][:many][sym].dup)
        elsif @@relations[self.class][:one].has_key?(sym)
          return Relation::One.new(self, sym, @@relations[self.class][:one][sym].dup)
        end
      end
      raise NoMethodError, "undefined method `#{sym}' for #{self}"
    end
def method_missing ( sym , * args , & block ) if sym . to_s . start_with? ( 'attribute_' ) attribute = sym . to_s . sub ( / ^attribute_ / , '' ) return @xml . attributes [ attribute ] elsif @@relations . has_key? ( self . class ) if @@relations [ self . class ] [ :many ] . has_key? ( sym ) return Relation :: Many . new ( self , sym , @@relations [ self . class ] [ :many ] [ sym ] . dup ) elsif @@relations [ self . class ] [ :one ] . has_key? ( sym ) return Relation :: One . new ( self , sym , @@relations [ self . class ] [ :one ] [ sym ] . dup ) end end raise NoMethodError , "undefined method `#{sym}' for #{self}" end
for call attributes of xml just prefix with *attribute_
for call attributes of xml just prefix with * attribute_
sym
args
block