Class: Crabfarm::Modes::Shared::InteractiveDecorator::InteractiveHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/crabfarm/modes/shared/interactive_decorator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse_input(_val) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/crabfarm/modes/shared/interactive_decorator.rb', line 15

def self.parse_input(_val)
  case _val
  when 'true' then true
  when 'false' then false
  when 'nil' then nil
  when /^\d+$/ then _val.to_i
  when /^\d*\.\d+$/ then _val.to_f
  when /^:[^\s]+$/ then _val.to_sym
  when /^\'.*?\'$/ then _val[1...-1]
  when /^\".*?\"$/ then _val[1...-1]
  else _val end
end

Instance Method Details

#merge(*args) ⇒ Object



35
36
37
# File 'lib/crabfarm/modes/shared/interactive_decorator.rb', line 35

def merge(*args)
  InteractiveHash.new.merge! super
end