Class: TagAlong::Offsets
- Inherits:
-
Object
- Object
- TagAlong::Offsets
- Includes:
- Enumerable
- Defined in:
- lib/tag_along/offsets.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(offsets, opts = {}) ⇒ Offsets
constructor
A new instance of Offsets.
Constructor Details
#initialize(offsets, opts = {}) ⇒ Offsets
Returns a new instance of Offsets.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/tag_along/offsets.rb', line 6 def initialize(offsets, opts = {}) @offsets = offsets @offset_start = (opts[:offset_start] || 'offset_start').to_sym @offset_end = (opts[:offset_end] || 'offset_end').to_sym @item_string = (opts[:item_string] || 'item_string').to_sym item = @offsets.first if item.is_a?(Array) process_array elsif item.is_a?(Hash) process_hash else process_obj end end |
Instance Method Details
#each(&block) ⇒ Object
23 24 25 26 27 |
# File 'lib/tag_along/offsets.rb', line 23 def each(&block) @offsets.each do |o| block.call(o) end end |