Sha256: e570b369ffa625704105659b478c178660301e0782d6aee3e791b9b11dc76fac

Contents?: true

Size: 399 Bytes

Versions: 2

Compression:

Stored size: 399 Bytes

Contents

module Anvil
  # Detect whether the options parser has parsed any option or not in
  # order, for example, to write the required help for them.
  class OptionsDetector
    attr_accessor :has_options

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

    def arguments(*_, &_block)
    end

    def detect_options(&block)
      instance_eval(&block)

      has_options
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
anvil-core-0.6.0 lib/anvil/options_detector.rb
anvil-core-0.5.0 lib/anvil/options_detector.rb