class Lutaml::Uml::Formatter::Base

Attributes

type[R]

Public Class Methods

format(node, attributes = {}) click to toggle source
# File lib/lutaml/uml/formatter/base.rb, line 15
def format(node, attributes = {})
  new(attributes).format(node)
end
inherited(subclass) click to toggle source
# File lib/lutaml/uml/formatter/base.rb, line 11
def inherited(subclass)
  Formatter.all << subclass
end
name() click to toggle source
# File lib/lutaml/uml/formatter/base.rb, line 19
def name
  to_s.split("::").last.downcase.to_sym
end
new(attributes = {}) click to toggle source

rubocop:disable Rails/ActiveRecordAliases

# File lib/lutaml/uml/formatter/base.rb, line 27
def initialize(attributes = {})
  update_attributes(attributes)
end

Public Instance Methods

format(node) click to toggle source
# File lib/lutaml/uml/formatter/base.rb, line 42
def format(node)
  case node
  when Node::Field  then format_field(node)
  when Node::Method then format_method(node)
  when Node::Relationship then format_relationship(node)
  when Node::ClassRelationship then format_class_relationship(node)
  when Node::ClassNode then format_class(node)
  when Lutaml::Uml::Document then format_document(node)
  end
end
format_class(_node) click to toggle source
# File lib/lutaml/uml/formatter/base.rb, line 61
def format_class(_node);              raise NotImplementedError; end
format_class_relationship(_node) click to toggle source
# File lib/lutaml/uml/formatter/base.rb, line 59
def format_class_relationship(_node); raise NotImplementedError; end
format_document(_node) click to toggle source
# File lib/lutaml/uml/formatter/base.rb, line 63
def format_document(_node);           raise NotImplementedError; end
format_field(_node) click to toggle source
# File lib/lutaml/uml/formatter/base.rb, line 53
def format_field(_node);              raise NotImplementedError; end
format_method(_node) click to toggle source
# File lib/lutaml/uml/formatter/base.rb, line 55
def format_method(_node);             raise NotImplementedError; end
format_relationship(_node) click to toggle source
# File lib/lutaml/uml/formatter/base.rb, line 57
def format_relationship(_node);       raise NotImplementedError; end
name() click to toggle source

rubocop:enable Rails/ActiveRecordAliases

# File lib/lutaml/uml/formatter/base.rb, line 32
def name
  self.class.name
end
type=(value) click to toggle source
# File lib/lutaml/uml/formatter/base.rb, line 38
def type=(value)
  @type = value.to_s.strip.downcase.to_sym
end