Class: Ceres::Attribute
- Inherits:
-
Object
- Object
- Ceres::Attribute
- Defined in:
- lib/ceres/attribute.rb
Defined Under Namespace
Classes: DSL
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#inspector ⇒ Object
Returns the value of attribute inspector.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#reader ⇒ Object
Returns the value of attribute reader.
-
#target ⇒ Object
Returns the value of attribute target.
-
#variable ⇒ Object
Returns the value of attribute variable.
-
#writer ⇒ Object
Returns the value of attribute writer.
Instance Method Summary collapse
- #apply(klass) ⇒ Object
-
#initialize(name, &block) ⇒ Attribute
constructor
A new instance of Attribute.
Constructor Details
#initialize(name, &block) ⇒ Attribute
86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/ceres/attribute.rb', line 86 def initialize(name, &block) @name = name.to_sym @description = nil @variable = "@#{name}".to_sym @reader = Ceres::Reader.new(self) @writer = nil @inspector = Ceres::Inspector.new Ceres::Attribute::DSL.new(self, &block) end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
41 42 43 |
# File 'lib/ceres/attribute.rb', line 41 def description @description end |
#inspector ⇒ Object
Returns the value of attribute inspector.
46 47 48 |
# File 'lib/ceres/attribute.rb', line 46 def inspector @inspector end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
39 40 41 |
# File 'lib/ceres/attribute.rb', line 39 def name @name end |
#reader ⇒ Object
Returns the value of attribute reader.
44 45 46 |
# File 'lib/ceres/attribute.rb', line 44 def reader @reader end |
#target ⇒ Object
Returns the value of attribute target.
43 44 45 |
# File 'lib/ceres/attribute.rb', line 43 def target @target end |
#variable ⇒ Object
Returns the value of attribute variable.
42 43 44 |
# File 'lib/ceres/attribute.rb', line 42 def variable @variable end |
#writer ⇒ Object
Returns the value of attribute writer.
45 46 47 |
# File 'lib/ceres/attribute.rb', line 45 def writer @writer end |
Instance Method Details
#apply(klass) ⇒ Object
99 100 101 102 103 104 |
# File 'lib/ceres/attribute.rb', line 99 def apply(klass) @reader.apply(klass) if @reader @writer.apply(klass) if @writer klass end |