Class: Uncov::Configuration::Option

Inherits:
Object
  • Object
show all
Defined in:
lib/uncov/configuration/option.rb

Overview

configuration option

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, description, options, default, allowed_values, value_parse) ⇒ Option

Returns a new instance of Option.



7
8
9
10
11
12
13
14
15
# File 'lib/uncov/configuration/option.rb', line 7

def initialize(name, description, options, default, allowed_values, value_parse)
  @name = name
  @description = description
  @options = Array(options)
  @default = default.freeze
  @value = default
  @allowed_values = allowed_values
  @value_parse = value_parse
end

Instance Attribute Details

#defaultObject (readonly)

Returns the value of attribute default.



5
6
7
# File 'lib/uncov/configuration/option.rb', line 5

def default
  @default
end

#descriptionObject (readonly)

Returns the value of attribute description.



5
6
7
# File 'lib/uncov/configuration/option.rb', line 5

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/uncov/configuration/option.rb', line 5

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/uncov/configuration/option.rb', line 5

def options
  @options
end

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/uncov/configuration/option.rb', line 5

def value
  @value
end

#value_parseObject (readonly)

Returns the value of attribute value_parse.



5
6
7
# File 'lib/uncov/configuration/option.rb', line 5

def value_parse
  @value_parse
end

Instance Method Details

#on_parser(parser) ⇒ Object



27
# File 'lib/uncov/configuration/option.rb', line 27

def on_parser(parser) = parser.on(*options, options_description) { |value| self.value = value_parse.call(value) }