Class: Force::Configuration::Option

Inherits:
Object
  • Object
show all
Defined in:
lib/force/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration, name, options = {}) ⇒ Option

Returns a new instance of Option.



47
48
49
50
# File 'lib/force/config.rb', line 47

def initialize(configuration, name, options = {})
  @configuration, @name, @options = configuration, name, options
  @default = options.fetch(:default, nil)
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



41
42
43
# File 'lib/force/config.rb', line 41

def configuration
  @configuration
end

#nameObject (readonly)

Returns the value of attribute name.



41
42
43
# File 'lib/force/config.rb', line 41

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



41
42
43
# File 'lib/force/config.rb', line 41

def options
  @options
end

Class Method Details

.define(*args) ⇒ Object



43
44
45
# File 'lib/force/config.rb', line 43

def self.define(*args)
  new(*args).define
end

Instance Method Details

#defineObject



52
53
54
55
56
# File 'lib/force/config.rb', line 52

def define
  write_attribute
  define_method if default_provided?
  self
end