Sha256: b65c3623bc586836358d4e0d046ac96afa3b2ecc08a392733a2d8e57a349958c

Contents?: true

Size: 380 Bytes

Versions: 2

Compression:

Stored size: 380 Bytes

Contents

require 'captain_config/models/base_config'

class CaptainConfig::IntegerConfig < CaptainConfig::BaseConfig
  def value
    Integer(self.text)
  end

  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

  def self.coerce(value)
    Integer(value)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
captain_config-1.1.0 lib/captain_config/models/integer_config.rb
captain_config-1.0.0 lib/captain_config/models/integer_config.rb