class Minicontext::Router::Maybe

Public Class Methods

new(val) click to toggle source
# File lib/minicontext/router.rb, line 4
def initialize(val)
  @val = val
end

Public Instance Methods

[](name) click to toggle source
# File lib/minicontext/router.rb, line 12
def [](name)
  klass = case val = @val.(name)
          when Context then Maybe
          when Proc    then Just
          else              Noting
          end

  klass.new(val)
end
value() click to toggle source
# File lib/minicontext/router.rb, line 8
def value
  @val
end