Class: ParameterDictionary

Inherits:
Object
  • Object
show all
Defined in:
lib/rimageanalysistools/create_parameters.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ String, Boolean

Adds hash-like getter access to ParameterDictionary objects

Parameters:

  • key

    an object whose to_s method returns the name of a parameter

Returns:

  • (String, Boolean)

    the value of the parameter as returned by ParameterDictionary#getValueForKey or a boolean if it’s a boolean parameter



40
41
42
43
44
45
46
47
48
# File 'lib/rimageanalysistools/create_parameters.rb', line 40

def [](key)
  val = getValueForKey(key.to_s)
  if val and val.downcase == "true"
    return true
  elsif val and val.downcase == "false" then
    return false
  end
  return val
end

#[]=(key, value) ⇒ void

This method returns an undefined value.

Adds hash-like setter access to ParameterDictionary objects

Parameters:

  • key

    an object whose to_s method returns the name of a parameter

  • value

    an object whose to_s method returns the parameter value being set



58
59
60
# File 'lib/rimageanalysistools/create_parameters.rb', line 58

def []=(key, value)
  setValueForKey(key.to_s, value.to_s)
end