Class: Covalence::Input

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/covalence/core/entities/input.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, *args) ⇒ Input

Returns a new instance of Input.



17
18
19
20
# File 'lib/covalence/core/entities/input.rb', line 17

def initialize(attributes = {}, *args)
  super
  self.valid?
end

Instance Method Details

#to_command_hash_elementsObject



31
32
33
# File 'lib/covalence/core/entities/input.rb', line 31

def to_command_hash_elements
   return name, parse_input(value()).delete_prefix('"').delete_suffix('"')
end

#to_command_optionObject



27
28
29
# File 'lib/covalence/core/entities/input.rb', line 27

def to_command_option
  "#{name} = #{parse_input(value())}"
end

#valueObject



22
23
24
25
# File 'lib/covalence/core/entities/input.rb', line 22

def value
  return raw_value if !raw_value.is_a?(Hash)
  get_value(raw_value)
end