Module: Dustbag::Parser::CollectionNode
- Extended by:
- Forwardable
- Includes:
- Node, Enumerable
- Included in:
- Accessories, Arguments, BrowseNodes, EditorialReviews, HttpHeaders, ImageSets, ItemLinks, Items, Languages, Offers, SimilarProducts, VariationAttributes, Variations
- Defined in:
- lib/dustbag/parser/collection_node.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary
Attributes included from Node
#node, #subnodes
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Node
#initialize, #repeated_subnodes, #repeated_subnodes_text, #subnode, #subnode_text
Class Method Details
.included(base) ⇒ Object
11
12
13
|
# File 'lib/dustbag/parser/collection_node.rb', line 11
def self.included(base)
base.extend(ClassMethods)
end
|
Instance Method Details
#collection ⇒ Object
15
16
17
18
19
20
|
# File 'lib/dustbag/parser/collection_node.rb', line 15
def collection
members = node && node.locate(member_name) || []
@collection ||= members.map do |member|
member_class.new(member)
end
end
|
#member_class ⇒ Object
26
27
28
|
# File 'lib/dustbag/parser/collection_node.rb', line 26
def member_class
Dustbag.const_get(member_name)
end
|
#member_name ⇒ Object
22
23
24
|
# File 'lib/dustbag/parser/collection_node.rb', line 22
def member_name
self.class.member_name
end
|