Class: Dicer::Context::Description

Inherits:
Object
  • Object
show all
Defined in:
lib/dicer/context/description.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(described_class, &block) ⇒ Description

Returns a new instance of Description.



6
7
8
9
10
11
# File 'lib/dicer/context/description.rb', line 6

def initialize(described_class, &block)
  @described_class = described_class
  @behaviors = []

  instance_eval(&block) if block_given?
end

Instance Attribute Details

#behaviorsObject (readonly)

Returns the value of attribute behaviors.



12
13
14
# File 'lib/dicer/context/description.rb', line 12

def behaviors
  @behaviors
end

#described_classObject (readonly)

Returns the value of attribute described_class.



12
13
14
# File 'lib/dicer/context/description.rb', line 12

def described_class
  @described_class
end

Instance Method Details

#delegatorObject



22
23
24
# File 'lib/dicer/context/description.rb', line 22

def delegator
  @delegator ||= Dicer::Delegator.make(@described_class, @behaviors)
end

#it_behaves_like(behavior) ⇒ Object



14
15
16
# File 'lib/dicer/context/description.rb', line 14

def it_behaves_like(behavior)
  @behaviors << behavior
end

#merge!(other) ⇒ Object



18
19
20
# File 'lib/dicer/context/description.rb', line 18

def merge!(other)
  @behaviors.concat(other.behaviors)
end