Class: KathyLee::Attributes

Inherits:
Object
  • Object
show all
Defined in:
lib/kathy_lee/attributes.rb

Defined Under Namespace

Classes: Binding

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, &block) ⇒ Attributes

Returns a new instance of Attributes.



6
7
8
9
# File 'lib/kathy_lee/attributes.rb', line 6

def initialize(attributes = {}, &block)
  self.attributes = attributes
  self.code_block = block
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



3
4
5
# File 'lib/kathy_lee/attributes.rb', line 3

def attributes
  @attributes
end

#code_blockObject

Returns the value of attribute code_block.



4
5
6
# File 'lib/kathy_lee/attributes.rb', line 4

def code_block
  @code_block
end

Instance Method Details

#process(attribs = {}) ⇒ Object



11
12
13
14
15
# File 'lib/kathy_lee/attributes.rb', line 11

def process(attribs = {})
  b = KathyLee::Attributes::Binding.new(self.attributes.merge(attribs), &self.code_block)
  b.process!
  return b.results
end