Class: TwitterCldr::Resources::CldrDocumentSet::ElementList
- Inherits:
-
Object
- Object
- TwitterCldr::Resources::CldrDocumentSet::ElementList
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/twitter_cldr/resources/cldr_document_set.rb
Instance Attribute Summary collapse
-
#docset ⇒ Object
readonly
Returns the value of attribute docset.
-
#elements ⇒ Object
readonly
Returns the value of attribute elements.
Instance Method Summary collapse
- #[](idx) ⇒ Object
- #each ⇒ Object
- #first ⇒ Object
-
#initialize(docset, elements) ⇒ ElementList
constructor
A new instance of ElementList.
Constructor Details
#initialize(docset, elements) ⇒ ElementList
Returns a new instance of ElementList.
39 40 41 42 |
# File 'lib/twitter_cldr/resources/cldr_document_set.rb', line 39 def initialize(docset, elements) @docset = docset @elements = elements end |
Instance Attribute Details
#docset ⇒ Object (readonly)
Returns the value of attribute docset.
37 38 39 |
# File 'lib/twitter_cldr/resources/cldr_document_set.rb', line 37 def docset @docset end |
#elements ⇒ Object (readonly)
Returns the value of attribute elements.
37 38 39 |
# File 'lib/twitter_cldr/resources/cldr_document_set.rb', line 37 def elements @elements end |
Instance Method Details
#[](idx) ⇒ Object
44 45 46 47 48 |
# File 'lib/twitter_cldr/resources/cldr_document_set.rb', line 44 def [](idx) return unless elements[idx] Element.new(docset, elements[idx]) end |
#each ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/twitter_cldr/resources/cldr_document_set.rb', line 54 def each return to_enum(__method__) unless block_given? elements.size.times do |idx| yield self[idx] end end |
#first ⇒ Object
50 51 52 |
# File 'lib/twitter_cldr/resources/cldr_document_set.rb', line 50 def first self[0] end |