Class: Convoy::Formatter::Options

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/convoy/formatter/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parser, setup, context) ⇒ Options

Returns a new instance of Options.



8
9
10
11
12
# File 'lib/convoy/formatter/options.rb', line 8

def initialize(parser, setup, context)
    @parser  = parser
    @setup   = setup
    @context = context
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



6
7
8
# File 'lib/convoy/formatter/options.rb', line 6

def context
  @context
end

#parserObject (readonly)

Returns the value of attribute parser.



6
7
8
# File 'lib/convoy/formatter/options.rb', line 6

def parser
  @parser
end

#setupObject (readonly)

Returns the value of attribute setup.



6
7
8
# File 'lib/convoy/formatter/options.rb', line 6

def setup
  @setup
end

Instance Method Details

#countObject Also known as: size



21
22
23
# File 'lib/convoy/formatter/options.rb', line 21

def count
    parser.specs.keys.size
end

#each(&block) ⇒ Object



14
15
16
17
18
19
# File 'lib/convoy/formatter/options.rb', line 14

def each(&block)
    parser.specs.each do |option_name, details|
        option = Option.new(option_name, details, setup, context)
        block.call(option)
    end
end