Class: Lutaml::Formatter::Base
- Inherits:
-
Object
- Object
- Lutaml::Formatter::Base
- Includes:
- Uml::HasAttributes
- Defined in:
- lib/lutaml/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_attribute(_node) ⇒ Object
- #format_class(_node) ⇒ Object
- #format_class_relationship(_node) ⇒ Object
- #format_document(_node) ⇒ Object
- #format_operation(_node) ⇒ Object
- #format_relationship(_node) ⇒ Object
-
#initialize(attributes = {}) ⇒ Base
constructor
rubocop:disable Rails/ActiveRecordAliases.
-
#name ⇒ Object
rubocop:enable Rails/ActiveRecordAliases.
Methods included from Uml::HasAttributes
Constructor Details
#initialize(attributes = {}) ⇒ Base
rubocop:disable Rails/ActiveRecordAliases
26 27 28 |
# File 'lib/lutaml/formatter/base.rb', line 26 def initialize(attributes = {}) update_attributes(attributes) end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
35 36 37 |
# File 'lib/lutaml/formatter/base.rb', line 35 def type @type end |
Class Method Details
.format(node, attributes = {}) ⇒ Object
14 15 16 |
# File 'lib/lutaml/formatter/base.rb', line 14 def format(node, attributes = {}) new(attributes).format(node) end |
.inherited(subclass) ⇒ Object
rubocop:disable Lint/MissingSuper
10 11 12 |
# File 'lib/lutaml/formatter/base.rb', line 10 def inherited(subclass) # rubocop:disable Lint/MissingSuper Formatter.all << subclass end |
.name ⇒ Object
18 19 20 |
# File 'lib/lutaml/formatter/base.rb', line 18 def name to_s.split("::").last.downcase.to_sym end |
Instance Method Details
#format(node) ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/lutaml/formatter/base.rb', line 41 def format(node) # rubocop:disable Metrics/CyclomaticComplexity case node when ::Lutaml::Uml::Node::Attribute then format_attribute(node) when ::Lutaml::Uml::Node::Operation then format_operation(node) when ::Lutaml::Uml::Node::Relationship then format_relationship(node) when ::Lutaml::Uml::Node::ClassRelationship format_class_relationship(node) when ::Lutaml::Uml::Node::ClassNode then format_class(node) when ::Lutaml::Uml::Document then format_document(node) end end |
#format_attribute(_node) ⇒ Object
53 |
# File 'lib/lutaml/formatter/base.rb', line 53 def format_attribute(_node); raise NotImplementedError; end |
#format_class(_node) ⇒ Object
61 |
# File 'lib/lutaml/formatter/base.rb', line 61 def format_class(_node); raise NotImplementedError; end |
#format_class_relationship(_node) ⇒ Object
59 |
# File 'lib/lutaml/formatter/base.rb', line 59 def format_class_relationship(_node); raise NotImplementedError; end |
#format_document(_node) ⇒ Object
63 |
# File 'lib/lutaml/formatter/base.rb', line 63 def format_document(_node); raise NotImplementedError; end |
#format_operation(_node) ⇒ Object
55 |
# File 'lib/lutaml/formatter/base.rb', line 55 def format_operation(_node); raise NotImplementedError; end |
#format_relationship(_node) ⇒ Object
57 |
# File 'lib/lutaml/formatter/base.rb', line 57 def format_relationship(_node); raise NotImplementedError; end |
#name ⇒ Object
rubocop:enable Rails/ActiveRecordAliases
31 32 33 |
# File 'lib/lutaml/formatter/base.rb', line 31 def name self.class.name end |