Module: Plumb::Callable

Included in:
Composable, Schema::Field
Defined in:
lib/plumb/composable.rb

Instance Method Summary collapse

Instance Method Details

#call(result) ⇒ Object

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/plumb/composable.rb', line 37

def call(result)
  raise NotImplementedError, "Implement #call(Result) => Result in #{self.class}"
end

#parse(value = Undefined) ⇒ Object

Raises:



30
31
32
33
34
35
# File 'lib/plumb/composable.rb', line 30

def parse(value = Undefined)
  result = resolve(value)
  raise ParseError, result.errors if result.invalid?

  result.value
end

#resolve(value = Undefined) ⇒ Object



26
27
28
# File 'lib/plumb/composable.rb', line 26

def resolve(value = Undefined)
  call(Result.wrap(value))
end