Class: CompositePrimaryKeys::CompositeKeys
- Inherits:
-
Array
- Object
- Array
- CompositePrimaryKeys::CompositeKeys
- Defined in:
- lib/composite_primary_keys/composite_arrays.rb
Class Method Summary collapse
Instance Method Summary collapse
- #to_s ⇒ Object (also: #to_param)
Class Method Details
.parse(value) ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/composite_primary_keys/composite_arrays.rb', line 41 def self.parse(value) case value when Array value.to_composite_keys when String value.split(ID_SEP).map { |key| Utils.unescape_string_key(key) }.to_composite_keys else raise(ArgumentError, "Unsupported type: #{value}") end end |
Instance Method Details
#to_s ⇒ Object Also known as: to_param
52 53 54 55 |
# File 'lib/composite_primary_keys/composite_arrays.rb', line 52 def to_s # Doing this makes it easier to parse Base#[](attr_name) map { |key| Utils.escape_string_key(key.to_s) }.join(ID_SEP) end |