Class: Gretel::Crumbs::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/gretel/crumbs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBuilder

Returns a new instance of Builder.



62
63
64
# File 'lib/gretel/crumbs.rb', line 62

def initialize
  @crumbs = {}
end

Instance Attribute Details

#crumbsObject (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.

Returns:

  • (Boolean)


77
78
79
# File 'lib/gretel/crumbs.rb', line 77

def crumb_defined?(key)
  crumbs.has_key?(key)
end