Module: Parsed::Parseable::ClassMethods
- Defined in:
- lib/parsed/parseable.rb
Instance Attribute Summary collapse
-
#parseable_fields ⇒ Object
Returns the value of attribute parseable_fields.
-
#parseable_hash ⇒ Object
Returns the value of attribute parseable_hash.
-
#parser ⇒ Object
Returns the value of attribute parser.
Instance Method Summary collapse
- #parse(data, parser = ParsesJson) ⇒ Object
-
#parses(*attributes) ⇒ Object
Public: Registers attributes that are to be parsed.
Instance Attribute Details
#parseable_fields ⇒ Object
Returns the value of attribute parseable_fields.
17 18 19 |
# File 'lib/parsed/parseable.rb', line 17 def parseable_fields @parseable_fields end |
#parseable_hash ⇒ Object
Returns the value of attribute parseable_hash.
17 18 19 |
# File 'lib/parsed/parseable.rb', line 17 def parseable_hash @parseable_hash end |
#parser ⇒ Object
Returns the value of attribute parser.
17 18 19 |
# File 'lib/parsed/parseable.rb', line 17 def parser @parser end |
Instance Method Details
#parse(data, parser = ParsesJson) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/parsed/parseable.rb', line 21 def parse(data, parser = ParsesJson) @parser = parser @parseable_hash = parser.parse(data) instance = new parse_fields(instance) instance end |
#parses(*attributes) ⇒ Object
42 43 44 45 46 |
# File 'lib/parsed/parseable.rb', line 42 def parses(*attributes) attributes.each do |attributes| parseable_fields << attributes end end |