Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/molten_core/array.rb
Instance Method Summary collapse
- #compact_blank! ⇒ Object
- #deep_strip! ⇒ Object
- #delete!(default = nil, &block) ⇒ Object
- #extract_options ⇒ Object
Instance Method Details
#compact_blank! ⇒ Object
12 13 14 |
# File 'lib/molten_core/array.rb', line 12 def compact_blank! delete_if(&:blank?) end |
#deep_strip! ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/molten_core/array.rb', line 16 def deep_strip! each_with_index do |value, index| if value.respond_to?(:strip) self[index] = value.strip elsif value.respond_to?(:deep_strip!) self[index] = value.deep_strip! end end end |
#delete!(default = nil, &block) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/molten_core/array.rb', line 4 def delete!(default = nil, &block) index_of_item = index(&block) return default unless index_of_item.present? delete_at index_of_item end |
#extract_options ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/molten_core/array.rb', line 26 def if last.is_a?(Hash) && last. last else {} end end |