Top Level Namespace
Defined Under Namespace
Modules: Tchae Classes: Module, Object
Instance Method Summary collapse
-
#Return(result, error = nil) ⇒ Object
central return wrapper.
-
#Tchae(inp) ⇒ Object
Central validator factory.
Instance Method Details
#Return(result, error = nil) ⇒ Object
central return wrapper
470 471 472 |
# File 'lib/tchae/core.rb', line 470 def Return(result, error = nil) Tchae::ResultWrapper.new(result, error) end |
#Tchae(inp) ⇒ Object
Central validator factory
292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/tchae/core.rb', line 292 def Tchae(inp) case inp when Class Tchae::Validator.new -> { is_a?(inp) }, msg: "is not a #{inp}" when Symbol Tchae::Validator.new -> { respond_to?(inp) }, msg: "does not respond to #{inp}" when Proc Tchae::Validator.new inp when Array Tchae::Validator1.new ->(value) { inp.find(value) } else Tchae::Validator.new inp.to_proc end end |