Class: Ceres::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/ceres/attribute.rb

Defined Under Namespace

Classes: DSL

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#descriptionObject

Returns the value of attribute description.



41
42
43
# File 'lib/ceres/attribute.rb', line 41

def description
  @description
end

#inspectorObject

Returns the value of attribute inspector.



46
47
48
# File 'lib/ceres/attribute.rb', line 46

def inspector
  @inspector
end

#nameObject (readonly)

Returns the value of attribute name.



39
40
41
# File 'lib/ceres/attribute.rb', line 39

def name
  @name
end

#readerObject

Returns the value of attribute reader.



44
45
46
# File 'lib/ceres/attribute.rb', line 44

def reader
  @reader
end

#targetObject

Returns the value of attribute target.



43
44
45
# File 'lib/ceres/attribute.rb', line 43

def target
  @target
end

#variableObject

Returns the value of attribute variable.



42
43
44
# File 'lib/ceres/attribute.rb', line 42

def variable
  @variable
end

#writerObject

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