Class: HammerCLI::Options::Normalizers::Number
Class Method Summary
collapse
Instance Method Summary
collapse
#complete, #completion_type, #description, inherited
Class Method Details
.common_description ⇒ Object
206
207
208
|
# File 'lib/hammer_cli/options/normalizers.rb', line 206
def common_description
_('Numeric value. Integer')
end
|
.completion_type ⇒ Object
202
203
204
|
# File 'lib/hammer_cli/options/normalizers.rb', line 202
def completion_type
:number
end
|
Instance Method Details
211
212
213
214
215
216
217
|
# File 'lib/hammer_cli/options/normalizers.rb', line 211
def format(val)
if numeric?(val)
val.to_i
else
raise ArgumentError, _("Numeric value is required.")
end
end
|
#numeric?(val) ⇒ Boolean
219
220
221
|
# File 'lib/hammer_cli/options/normalizers.rb', line 219
def numeric?(val)
Integer(val) != nil rescue false
end
|