Module: Charisma::Base::ClassMethods
- Defined in:
- lib/charisma/base/class_methods.rb
Overview
Methods included on the characterized class
Class Method Summary collapse
-
.extended(base) ⇒ Object
Establishes a
@@characterization
class variable along with a#characterization
accessor on the class.
Instance Method Summary collapse
-
#characterize(&blk) ⇒ Object
Define a characterization on the class.
Class Method Details
.extended(base) ⇒ Object
Establishes a @@characterization
class variable along with a #characterization
accessor on the class.
8 9 10 11 |
# File 'lib/charisma/base/class_methods.rb', line 8 def self.extended(base) base.send :class_variable_set, :@@characterization, Characterization.new base.send :cattr_reader, :characterization, :instance_reader => false end |
Instance Method Details
#characterize(&blk) ⇒ Object
Define a characterization on the class.
The definition occurs within the block, using Charisma::Characterization#has
as a DSL.
17 18 19 |
# File 'lib/charisma/base/class_methods.rb', line 17 def characterize(&blk) Blockenspiel.invoke(blk, characterization) if block_given? end |