Module: Toy::Extensions::Array

Included in:
Array
Defined in:
lib/toy/extensions/array.rb

Instance Method Summary collapse

Instance Method Details

#from_store(value) ⇒ Object



13
14
15
# File 'lib/toy/extensions/array.rb', line 13

def from_store(value, *)
  value || store_default
end

#store_defaultObject



4
5
6
# File 'lib/toy/extensions/array.rb', line 4

def store_default
  []
end

#to_store(value) ⇒ Object



8
9
10
11
# File 'lib/toy/extensions/array.rb', line 8

def to_store(value, *)
  value = value.respond_to?(:lines) ? value.lines : value
  value.to_a
end