class Baha::ContainerOptions::Option
Constants
- KEYS
Attributes
config_key[R]
key[R]
value[R]
Public Class Methods
new(*args)
click to toggle source
# File lib/baha/container_options/option.rb, line 27 def initialize(*args) k,@value = args raise ArgumentError, "Cannot understand option key '#{k}'" unless k.respond_to?(:to_sym) @key = k.to_sym.downcase raise ERROR("Option with key '#{@key}' is not found. Expecting #{KEYS.keys.inspect}") unless KEYS.has_key?(@key) @config_key = KEYS[@key] end
Public Instance Methods
apply(config)
click to toggle source
Apply this option to the container’s config hash
# File lib/baha/container_options/option.rb, line 40 def apply(config) config[@config_key] = @value end
eql?(other)
click to toggle source
# File lib/baha/container_options/option.rb, line 35 def eql?(other) @key == other.key and @value == other.value end
inspect()
click to toggle source
# File lib/baha/container_options/option.rb, line 49 def inspect "#{self.class.name}<@key=#{@key.inspect},@value=#{@value.inspect}>" end
validate!()
click to toggle source
Validate the option’s value
# File lib/baha/container_options/option.rb, line 45 def validate! KEYS.has_key?(@key) end
Private Instance Methods
ERROR(reason)
click to toggle source
# File lib/baha/container_options/option.rb, line 54 def ERROR(reason) InvalidOptionError.new(@key,@value,reason) end