Class: Lutaml::Uml::Formatter::Base
- Inherits:
-
Object
- Object
- Lutaml::Uml::Formatter::Base
- Includes:
- HasAttributes
- Defined in:
- lib/lutaml/uml/formatter/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
- .format(node, attributes = {}) ⇒ Object
-
.inherited(subclass) ⇒ Object
rubocop:disable Lint/MissingSuper.
- .name ⇒ Object
Instance Method Summary collapse
-
#format(node) ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity.
- #format_class(_node) ⇒ Object
- #format_class_relationship(_node) ⇒ Object
- #format_document(_node) ⇒ Object
- #format_field(_node) ⇒ Object
- #format_method(_node) ⇒ Object
- #format_relationship(_node) ⇒ Object
-
#initialize(attributes = {}) ⇒ Base
constructor
rubocop:disable Rails/ActiveRecordAliases.
-
#name ⇒ Object
rubocop:enable Rails/ActiveRecordAliases.
Methods included from HasAttributes
Constructor Details
#initialize(attributes = {}) ⇒ Base
rubocop:disable Rails/ActiveRecordAliases
27 28 29 |
# File 'lib/lutaml/uml/formatter/base.rb', line 27 def initialize(attributes = {}) update_attributes(attributes) end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
36 37 38 |
# File 'lib/lutaml/uml/formatter/base.rb', line 36 def type @type end |
Class Method Details
.format(node, attributes = {}) ⇒ Object
15 16 17 |
# File 'lib/lutaml/uml/formatter/base.rb', line 15 def format(node, attributes = {}) new(attributes).format(node) end |
.inherited(subclass) ⇒ Object
rubocop:disable Lint/MissingSuper
11 12 13 |
# File 'lib/lutaml/uml/formatter/base.rb', line 11 def inherited(subclass) # rubocop:disable Lint/MissingSuper Formatter.all << subclass end |
.name ⇒ Object
19 20 21 |
# File 'lib/lutaml/uml/formatter/base.rb', line 19 def name to_s.split("::").last.downcase.to_sym end |
Instance Method Details
#format(node) ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/lutaml/uml/formatter/base.rb', line 42 def format(node) # rubocop:disable Metrics/CyclomaticComplexity 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) ⇒ Object
61 |
# File 'lib/lutaml/uml/formatter/base.rb', line 61 def format_class(_node); raise NotImplementedError; end |
#format_class_relationship(_node) ⇒ Object
59 |
# File 'lib/lutaml/uml/formatter/base.rb', line 59 def format_class_relationship(_node); raise NotImplementedError; end |
#format_document(_node) ⇒ Object
63 |
# File 'lib/lutaml/uml/formatter/base.rb', line 63 def format_document(_node); raise NotImplementedError; end |
#format_field(_node) ⇒ Object
53 |
# File 'lib/lutaml/uml/formatter/base.rb', line 53 def format_field(_node); raise NotImplementedError; end |
#format_method(_node) ⇒ Object
55 |
# File 'lib/lutaml/uml/formatter/base.rb', line 55 def format_method(_node); raise NotImplementedError; end |
#format_relationship(_node) ⇒ Object
57 |
# File 'lib/lutaml/uml/formatter/base.rb', line 57 def format_relationship(_node); raise NotImplementedError; end |
#name ⇒ Object
rubocop:enable Rails/ActiveRecordAliases
32 33 34 |
# File 'lib/lutaml/uml/formatter/base.rb', line 32 def name self.class.name end |