Class: Ceres::Attribute::DSL
- Inherits:
-
Object
- Object
- Ceres::Attribute::DSL
- Defined in:
- lib/ceres/attribute.rb
Instance Method Summary collapse
- #description(text) ⇒ Object
-
#initialize(object, &block) ⇒ DSL
constructor
A new instance of DSL.
- #inspector(disabled: false, &block) ⇒ Object
- #reader(disabled: false, **args, &block) ⇒ Object
- #target(symbol) ⇒ Object
- #variable(symbol) ⇒ Object
- #writer(disabled: false, &block) ⇒ Object
Constructor Details
#initialize(object, &block) ⇒ DSL
Returns a new instance of DSL.
49 50 51 52 53 |
# File 'lib/ceres/attribute.rb', line 49 def initialize(object, &block) @object = object self.instance_exec(&block) if block end |
Instance Method Details
#description(text) ⇒ Object
55 56 57 |
# File 'lib/ceres/attribute.rb', line 55 def description(text) @object.description = text end |
#inspector(disabled: false, &block) ⇒ Object
79 80 81 82 83 |
# File 'lib/ceres/attribute.rb', line 79 def inspector(disabled: false, &block) inspector = Ceres::Inspector.new(&block) unless disabled @object.inspector = inspector end |
#reader(disabled: false, **args, &block) ⇒ Object
67 68 69 70 71 |
# File 'lib/ceres/attribute.rb', line 67 def reader(disabled: false, **args, &block) reader = Ceres::Reader.new(@object, **args, &block) unless disabled @object.reader = reader end |
#target(symbol) ⇒ Object
59 60 61 |
# File 'lib/ceres/attribute.rb', line 59 def target(symbol) @object.target = symbol end |
#variable(symbol) ⇒ Object
63 64 65 |
# File 'lib/ceres/attribute.rb', line 63 def variable(symbol) @object.variable = symbol end |