Class: CaptainConfig::IntegerConfig
- Inherits:
-
BaseConfig
- Object
- ActiveRecord::Base
- BaseConfig
- CaptainConfig::IntegerConfig
- Defined in:
- lib/captain_config/models/integer_config.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.coerce(value) ⇒ Object
16 17 18 |
# File 'lib/captain_config/models/integer_config.rb', line 16 def self.coerce(value) Integer(value) end |
Instance Method Details
#value ⇒ Object
4 5 6 |
# File 'lib/captain_config/models/integer_config.rb', line 4 def value Integer(self.text) end |
#value=(new_value) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/captain_config/models/integer_config.rb', line 8 def value=(new_value) unless new_value.is_a?(Integer) raise ArgumentError.new("Invalid value: #{new_value.inspect}") end self.text = new_value.to_s end |