Class: Xumlidot::Types::Attribute

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

Overview

Value object for an attribute, i.e. accessor defined via attr_reader, attr_writer or attribute

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, read, write) ⇒ Attribute

Returns a new instance of Attribute.



14
15
16
17
18
# File 'lib/xumlidot/types/attribute.rb', line 14

def initialize(name, read, write)
  @name = name.to_s
  @read = read
  @write = write
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/xumlidot/types/attribute.rb', line 10

def name
  @name
end

#readObject

Returns the value of attribute read.



10
11
12
# File 'lib/xumlidot/types/attribute.rb', line 10

def read
  @read
end

#writeObject

Returns the value of attribute write.



10
11
12
# File 'lib/xumlidot/types/attribute.rb', line 10

def write
  @write
end

Instance Method Details

#to_sObject



20
21
22
# File 'lib/xumlidot/types/attribute.rb', line 20

def to_s
  accessibility ? "(#{accessibility}) #{@name}" : @name
end