Class: WpxmlParser::Entity
- Inherits:
-
Object
- Object
- WpxmlParser::Entity
- Defined in:
- lib/wpxml_parser/entity.rb
Instance Method Summary collapse
-
#initialize(entity) ⇒ Entity
constructor
A new instance of Entity.
- #method_missing(meth, *args, &blk) ⇒ Object
Constructor Details
#initialize(entity) ⇒ Entity
Returns a new instance of Entity.
3 4 5 |
# File 'lib/wpxml_parser/entity.rb', line 3 def initialize(entity) @entity = entity end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &blk) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/wpxml_parser/entity.rb', line 7 def method_missing(meth, *args, &blk) if self.class.method_element_map.keys.include?(meth) if (public_methods - Object.public_methods).include?("process_#{meth}") send("process_#{meth}", @entity.xpath(self.class.method_element_map[meth]).first.content) else @entity.xpath(self.class.method_element_map[meth]).first.content end else super end end |