class Thy::Type

Public Class Methods

new(&checker) click to toggle source
# File lib/thy/type.rb, line 5
def initialize(&checker)
  @checker = checker
end

Public Instance Methods

check(value) click to toggle source
# File lib/thy/type.rb, line 9
def check(value)
  check_result = @checker.call(value)

  return Result::Success if check_result == true
  return Result::Failure.new('No message provided') if check_result == false

  check_result
end