Class: SAXMachine::SAXConfig::CollectionConfig
- Inherits:
-
Object
- Object
- SAXMachine::SAXConfig::CollectionConfig
- Defined in:
- lib/lazy-sax-machine/sax_collection_config.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.
7 8 9 10 11 12 13 14 15 |
# File 'lib/lazy-sax-machine/sax_collection_config.rb', line 7 def initialize(name, ) @name = name.to_s @class = [:class] @as = [:as].to_s if .has_key?(:with) @with = [:with].to_a.map {|(k,v)| [k.to_s, v.to_s] } end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/lazy-sax-machine/sax_collection_config.rb', line 5 def name @name end |
Instance Method Details
#accessor ⇒ Object
17 18 19 |
# File 'lib/lazy-sax-machine/sax_collection_config.rb', line 17 def accessor as end |
#attrs_match?(attrs) ⇒ Boolean
21 22 23 24 25 26 27 28 29 |
# File 'lib/lazy-sax-machine/sax_collection_config.rb', line 21 def attrs_match?(attrs) return true unless @with @with.all? do |k,v| if pair = attrs.assoc(k) pair.last == v end end end |
#data_class ⇒ Object
31 32 33 |
# File 'lib/lazy-sax-machine/sax_collection_config.rb', line 31 def data_class @class || @name end |