Class: ConfigManager::Item

Inherits:
Object
  • Object
show all
Defined in:
app/models/config_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#defaultObject

Returns the value of attribute default.



61
62
63
# File 'app/models/config_manager.rb', line 61

def default
  @default
end

#nameObject

Returns the value of attribute name.



61
62
63
# File 'app/models/config_manager.rb', line 61

def name
  @name
end

#ruby_typeObject

Returns the value of attribute ruby_type.



61
62
63
# File 'app/models/config_manager.rb', line 61

def ruby_type
  @ruby_type
end

Instance Method Details

#canonicalize(value) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'app/models/config_manager.rb', line 63

def canonicalize(value)
  case ruby_type
  when :boolean
    case value
    when "0", 0, "", false, "false", "f", nil
      false
    else
      true
    end
  when :integer
    value.to_i
  when :string
    value.to_s
  when :yaml
    value.to_yaml
  else
    value
  end
end