Class: Gretel::Crumbs::Builder
- Inherits:
-
Object
- Object
- Gretel::Crumbs::Builder
- Defined in:
- lib/gretel/crumbs.rb
Instance Attribute Summary collapse
-
#crumbs ⇒ Object
readonly
Returns a hash of all stored crumb blocks.
Instance Method Summary collapse
-
#crumb(key, &block) ⇒ Object
Stores the supplied block for later use.
-
#crumb_defined?(key) ⇒ Boolean
Returns true if a crumb with the given key has been set.
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize ⇒ Builder
Returns a new instance of Builder.
62 63 64 |
# File 'lib/gretel/crumbs.rb', line 62 def initialize @crumbs = {} end |
Instance Attribute Details
#crumbs ⇒ Object (readonly)
Returns a hash of all stored crumb blocks.
72 73 74 |
# File 'lib/gretel/crumbs.rb', line 72 def crumbs @crumbs end |
Instance Method Details
#crumb(key, &block) ⇒ Object
Stores the supplied block for later use.
67 68 69 |
# File 'lib/gretel/crumbs.rb', line 67 def crumb(key, &block) crumbs[key] = block end |
#crumb_defined?(key) ⇒ Boolean
Returns true if a crumb with the given key has been set.
77 78 79 |
# File 'lib/gretel/crumbs.rb', line 77 def crumb_defined?(key) crumbs.has_key?(key) end |