Class: Alchemrest::Transforms::FromString

Inherits:
FromType
  • Object
show all
Defined in:
lib/alchemrest/transforms/from_string.rb,
lib/alchemrest/transforms/from_string/to_type_transform_registry.rb

Defined Under Namespace

Classes: ToTypeTransformRegistry

Constant Summary collapse

OVERRIDES =
{ type: String }.freeze
CONSTRAINT_BUILDER_CLASS =
ConstraintBuilder::ForString

Constants inherited from FromType

Alchemrest::Transforms::FromType::DEFAULTS

Instance Method Summary collapse

Methods inherited from FromType

#array, #call, #maybe, #output_type, #output_type_name, #to

Constructor Details

#initialize(args = {}) ⇒ FromString

Returns a new instance of FromString.



9
10
11
# File 'lib/alchemrest/transforms/from_string.rb', line 9

def initialize(args = {})
  super(**args, **OVERRIDES)
end

Instance Method Details

#where(constraint_or_description = nil, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/alchemrest/transforms/from_string.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