class Xumlidot::Types::Attribute

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

Attributes

name[RW]
read[RW]
write[RW]

Public Class Methods

new(name, read, write) click to toggle source
# File lib/xumlidot/types/attribute.rb, line 15
def initialize(name, read, write)
  @name = name.to_s
  @read = read
  @write = write
end

Public Instance Methods

to_s() click to toggle source
# File lib/xumlidot/types/attribute.rb, line 21
def to_s
  "(#{accessibility}) #{@name}"
end

Private Instance Methods

accessibility() click to toggle source
# File lib/xumlidot/types/attribute.rb, line 27
def accessibility
  return 'r+w' if @read && @write
  return 'ro' if @read && !@write
  return 'wo' if !@read && @write
end