Class: Dicer::Context::Description
- Inherits:
-
Object
- Object
- Dicer::Context::Description
- Defined in:
- lib/dicer/context/description.rb
Instance Attribute Summary collapse
-
#behaviors ⇒ Object
readonly
Returns the value of attribute behaviors.
-
#described_class ⇒ Object
readonly
Returns the value of attribute described_class.
Instance Method Summary collapse
- #delegator ⇒ Object
-
#initialize(described_class, &block) ⇒ Description
constructor
A new instance of Description.
- #it_behaves_like(behavior) ⇒ Object
- #merge!(other) ⇒ Object
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
#behaviors ⇒ Object (readonly)
Returns the value of attribute behaviors.
12 13 14 |
# File 'lib/dicer/context/description.rb', line 12 def behaviors @behaviors end |
#described_class ⇒ Object (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
#delegator ⇒ Object
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 |