Class: Mycommands::Param

Inherits:
Object
  • Object
show all
Defined in:
lib/mycommands/models/param.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(param) ⇒ Param

Returns a new instance of Param.



32
33
34
# File 'lib/mycommands/models/param.rb', line 32

def initialize param
  @param = param
end

Instance Attribute Details

#substitutedObject (readonly)

Returns the value of attribute substituted.



30
31
32
# File 'lib/mycommands/models/param.rb', line 30

def substituted
  @substituted
end

Instance Method Details

#descriptionObject



36
37
38
# File 'lib/mycommands/models/param.rb', line 36

def description
  @param.values.flatten.first.to_s
end

#substitute(input) ⇒ Object



44
45
46
47
48
49
# File 'lib/mycommands/models/param.rb', line 44

def substitute input
  if input.empty? and description.include? "("
    input = description[/\((.*?)\)/, 1]
  end
  @substituted = input
end

#valueObject



40
41
42
# File 'lib/mycommands/models/param.rb', line 40

def value
  @param.keys.first.to_s
end