class ENVied::Variable

Attributes

default[R]
group[R]
name[R]
type[R]

Public Class Methods

new(name, type, **options) click to toggle source
# File lib/envied/variable.rb, line 4
def initialize(name, type, **options)
  @name = name.to_sym
  @type = type.to_sym
  @group = options.fetch(:group, :default).to_sym
  @default = options[:default]

  #if !@default.is_a? String
  #  raise ArgumentError, "Default values should be strings (variable #{@name})"
  #end
end

Public Instance Methods

==(other) click to toggle source
# File lib/envied/variable.rb, line 19
def ==(other)
  self.class == other.class &&
    [name, type, group, default] == [other.name, other.type, other.group, other.default]
end
default_value(*args) click to toggle source
# File lib/envied/variable.rb, line 15
def default_value(*args)
  default.respond_to?(:call) ? default[*args] : default
end