Class: Minicontext::Router::Maybe
- Inherits:
-
Object
- Object
- Minicontext::Router::Maybe
- Defined in:
- lib/minicontext/router.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
-
#initialize(val) ⇒ Maybe
constructor
A new instance of Maybe.
- #value ⇒ Object
Constructor Details
#initialize(val) ⇒ Maybe
Returns a new instance of Maybe.
4 5 6 |
# File 'lib/minicontext/router.rb', line 4 def initialize(val) @val = val end |
Instance Method Details
#[](name) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# 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 ⇒ Object
8 9 10 |
# File 'lib/minicontext/router.rb', line 8 def value @val end |