Class: SAXMachine::SAXConfig::CollectionConfig
- Inherits:
-
Object
- Object
- SAXMachine::SAXConfig::CollectionConfig
- Defined in:
- lib/sax-machine/config/sax_collection.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #accessor ⇒ Object
- #attrs_match?(attrs) ⇒ Boolean
- #data_class ⇒ Object
-
#initialize(name, options) ⇒ CollectionConfig
constructor
A new instance of CollectionConfig.
Constructor Details
#initialize(name, options) ⇒ CollectionConfig
Returns a new instance of CollectionConfig.
6 7 8 9 10 11 |
# File 'lib/sax-machine/config/sax_collection.rb', line 6 def initialize(name, ) @name = name.to_s @class = [:class] @as = [:as].to_s @with = .fetch(:with, {}) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/sax-machine/config/sax_collection.rb', line 4 def name @name end |
Instance Method Details
#accessor ⇒ Object
13 14 15 |
# File 'lib/sax-machine/config/sax_collection.rb', line 13 def accessor as end |
#attrs_match?(attrs) ⇒ Boolean
17 18 19 20 21 |
# File 'lib/sax-machine/config/sax_collection.rb', line 17 def attrs_match?(attrs) @with.all? do |key, value| value === attrs[key.to_s] end end |
#data_class ⇒ Object
23 24 25 |
# File 'lib/sax-machine/config/sax_collection.rb', line 23 def data_class @class || @name end |