Class: Clowne::Declarations::Trait
- Inherits:
-
Object
- Object
- Clowne::Declarations::Trait
- Defined in:
- lib/clowne/declarations/trait.rb
Overview
:nodoc: all
Instance Method Summary collapse
- #compiled ⇒ Object (also: #declarations)
- #dup ⇒ Object
- #extend_with(block) ⇒ Object
-
#initialize ⇒ Trait
constructor
A new instance of Trait.
Constructor Details
#initialize ⇒ Trait
Returns a new instance of Trait.
6 7 8 |
# File 'lib/clowne/declarations/trait.rb', line 6 def initialize @blocks = [] end |
Instance Method Details
#compiled ⇒ Object Also known as: declarations
14 15 16 17 18 |
# File 'lib/clowne/declarations/trait.rb', line 14 def compiled return @compiled if instance_variable_defined?(:@compiled) @compiled = compile end |
#dup ⇒ Object
22 23 24 25 26 |
# File 'lib/clowne/declarations/trait.rb', line 22 def dup self.class.new.tap do |duped| blocks.each { |b| duped.extend_with(b) } end end |
#extend_with(block) ⇒ Object
10 11 12 |
# File 'lib/clowne/declarations/trait.rb', line 10 def extend_with(block) @blocks << block end |