Class: Tomo::CLI::State

Inherits:
Object
  • Object
show all
Defined in:
lib/tomo/cli/state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeState

Returns a new instance of State.



8
9
10
11
12
# File 'lib/tomo/cli/state.rb', line 8

def initialize
  @args = []
  @options = Options.new
  @processed_rules = []
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



6
7
8
# File 'lib/tomo/cli/state.rb', line 6

def args
  @args
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/tomo/cli/state.rb', line 6

def options
  @options
end

#processed_rulesObject (readonly)

Returns the value of attribute processed_rules.



6
7
8
# File 'lib/tomo/cli/state.rb', line 6

def processed_rules
  @processed_rules
end

Instance Method Details

#parsed_arg(arg) ⇒ Object



14
15
16
# File 'lib/tomo/cli/state.rb', line 14

def parsed_arg(arg)
  args << arg
end

#parsed_option(key, value) ⇒ Object



18
19
20
# File 'lib/tomo/cli/state.rb', line 18

def parsed_option(key, value)
  options.all(key) << value
end

#processed?(rule) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/tomo/cli/state.rb', line 26

def processed?(rule)
  @processed_rules.include?(rule)
end

#processed_rule(rule) ⇒ Object



22
23
24
# File 'lib/tomo/cli/state.rb', line 22

def processed_rule(rule)
  @processed_rules |= [rule]
end