Class: Array
Instance Method Summary collapse
- #exclude?(value) ⇒ Boolean
- #map_to(field) ⇒ Object
- #to_data ⇒ Object
- #to_h ⇒ Object
- #to_hash_with_indexes_as_keys ⇒ Object
Instance Method Details
#exclude?(value) ⇒ Boolean
14 15 16 |
# File 'lib/core_extensions/array.rb', line 14 def exclude?(value) !include?(value) end |
#map_to(field) ⇒ Object
10 11 12 |
# File 'lib/core_extensions/array.rb', line 10 def map_to(field) self.map { |hash| hash[field] } end |
#to_data ⇒ Object
6 7 8 |
# File 'lib/core_extensions/array.rb', line 6 def to_data map(&:to_h) end |
#to_hash_with_indexes_as_keys ⇒ Object
18 19 20 |
# File 'lib/core_extensions/array.rb', line 18 def to_hash_with_indexes_as_keys each_with_index.map { |option,index| [index,option] }.to_h end |