Class: Alchemrest::Transforms::FromNumber
- Defined in:
- lib/alchemrest/transforms/from_number.rb,
lib/alchemrest/transforms/from_number/to_type_transform_registry.rb
Defined Under Namespace
Classes: ToTypeTransformRegistry
Constant Summary collapse
- OVERRIDES =
{ type: T.any(Integer, Float) }.freeze
- CONSTRAINT_BUILDER_CLASS =
ConstraintBuilder::ForNumber
Constants inherited from FromType
Alchemrest::Transforms::FromType::DEFAULTS
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ FromNumber
constructor
A new instance of FromNumber.
- #output_type_name ⇒ Object
- #where(constraint_or_description = nil, &block) ⇒ Object
Methods inherited from FromType
#array, #call, #maybe, #output_type, #to
Constructor Details
#initialize(args = {}) ⇒ FromNumber
Returns a new instance of FromNumber.
9 10 11 |
# File 'lib/alchemrest/transforms/from_number.rb', line 9 def initialize(args = {}) super(**args, **OVERRIDES) end |
Instance Method Details
#output_type_name ⇒ Object
23 24 25 |
# File 'lib/alchemrest/transforms/from_number.rb', line 23 def output_type_name "Number" end |
#where(constraint_or_description = nil, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/alchemrest/transforms/from_number.rb', line 13 def where(constraint_or_description = nil, &block) if constraint_or_description super elsif block raise ArgumentError, "Must provide a constraint or description" else self end end |