Class: YARD::Virtus::CodeObjects::AttributeWriter
- Inherits:
-
Object
- Object
- YARD::Virtus::CodeObjects::AttributeWriter
- Defined in:
- lib/yard/virtus/code_objects/attribute_writer.rb
Instance Attribute Summary collapse
-
#attr_name ⇒ Object
readonly
Returns the value of attribute attr_name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(attr, type, is_private = false) ⇒ AttributeWriter
constructor
A new instance of AttributeWriter.
- #method_name ⇒ Object
- #yard_method_object(namespace) ⇒ Object
Constructor Details
#initialize(attr, type, is_private = false) ⇒ AttributeWriter
Returns a new instance of AttributeWriter.
10 11 12 13 14 |
# File 'lib/yard/virtus/code_objects/attribute_writer.rb', line 10 def initialize(attr, type, is_private=false) @attr_name = attr @type = type @is_private = is_private end |
Instance Attribute Details
#attr_name ⇒ Object (readonly)
Returns the value of attribute attr_name.
5 6 7 |
# File 'lib/yard/virtus/code_objects/attribute_writer.rb', line 5 def attr_name @attr_name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/yard/virtus/code_objects/attribute_writer.rb', line 5 def type @type end |
Instance Method Details
#method_name ⇒ Object
16 17 18 |
# File 'lib/yard/virtus/code_objects/attribute_writer.rb', line 16 def method_name :"#{attr_name}=" end |
#yard_method_object(namespace) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/yard/virtus/code_objects/attribute_writer.rb', line 20 def yard_method_object(namespace) YARD::CodeObjects::MethodObject.new(namespace, method_name, :instance).tap do |mo| mo.parameters = [["value", default_value]] mo.add_tag param_tag("value", type) mo.add_tag private_tag if private? end end |