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.



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

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

Instance Attribute Details

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#readObject

Returns the value of attribute read.



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

def read
  @read
end

#writeObject

Returns the value of attribute write.



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

def write
  @write
end

Instance Method Details

#to_sObject



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

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