Class: HammerCLI::Options::Validators::DSL
- Inherits:
-
Object
- Object
- HammerCLI::Options::Validators::DSL
show all
- Defined in:
- lib/hammer_cli/options/validators/dsl.rb
Defined Under Namespace
Classes: AllConstraint, AnyConstraint, BaseConstraint, OneOfConstraint, OneOptionConstraint
Instance Method Summary
collapse
Constructor Details
#initialize(options, option_values) ⇒ DSL
Returns a new instance of DSL.
133
134
135
136
|
# File 'lib/hammer_cli/options/validators/dsl.rb', line 133
def initialize(options, option_values)
@options = options
@option_values = option_values
end
|
Instance Method Details
#all(*to_check) ⇒ Object
138
139
140
|
# File 'lib/hammer_cli/options/validators/dsl.rb', line 138
def all(*to_check)
AllConstraint.new(@options, @option_values, to_check.flatten(1))
end
|
#any(*to_check) ⇒ Object
146
147
148
|
# File 'lib/hammer_cli/options/validators/dsl.rb', line 146
def any(*to_check)
AnyConstraint.new(@options, @option_values, to_check.flatten(1))
end
|
#one_of(*to_check) ⇒ Object
150
151
152
|
# File 'lib/hammer_cli/options/validators/dsl.rb', line 150
def one_of(*to_check)
OneOfConstraint.new(@options, @option_values, to_check.flatten(1))
end
|
#option(to_check) ⇒ Object
142
143
144
|
# File 'lib/hammer_cli/options/validators/dsl.rb', line 142
def option(to_check)
OneOptionConstraint.new(@options, @option_values, to_check)
end
|
#run(&block) ⇒ Object
154
155
156
|
# File 'lib/hammer_cli/options/validators/dsl.rb', line 154
def run(&block)
self.instance_eval(&block)
end
|