Class: Anvil::OptionsDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/anvil/options_detector.rb

Overview

Detect whether the options parser has parsed any option or not in order, for example, to write the required help for them.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#has_optionsObject

Returns the value of attribute has_options.



5
6
7
# File 'lib/anvil/options_detector.rb', line 5

def has_options
  @has_options
end

Instance Method Details

#arguments(*_, &_block) ⇒ Object



11
12
# File 'lib/anvil/options_detector.rb', line 11

def arguments(*_, &_block)
end

#detect_options(&block) ⇒ Object



14
15
16
17
18
# File 'lib/anvil/options_detector.rb', line 14

def detect_options(&block)
  instance_eval(&block)

  has_options
end

#on(*_, &_block) ⇒ Object



7
8
9
# File 'lib/anvil/options_detector.rb', line 7

def on(*_, &_block)
  self.has_options = true
end