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
23 24 25 |
# File 'lib/lutaml/formatter/base.rb', line 23 def initialize(attributes = {}) update_attributes(attributes) end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
32 33 34 |
# File 'lib/lutaml/formatter/base.rb', line 32 def type @type end |
Class Method Details
.format(node, attributes = {}) ⇒ Object
11 12 13 |
# File 'lib/lutaml/formatter/base.rb', line 11 def format(node, attributes = {}) new(attributes).format(node) end |
.inherited(subclass) ⇒ Object
rubocop:disable Lint/MissingSuper
7 8 9 |
# File 'lib/lutaml/formatter/base.rb', line 7 def inherited(subclass) # rubocop:disable Lint/MissingSuper Formatter.all << subclass end |
.name ⇒ Object
15 16 17 |
# File 'lib/lutaml/formatter/base.rb', line 15 def name to_s.split("::").last.downcase.to_sym end |
Instance Method Details
#format(node) ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/lutaml/formatter/base.rb', line 38 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
50 |
# File 'lib/lutaml/formatter/base.rb', line 50 def format_attribute(_node); raise NotImplementedError; end |
#format_class(_node) ⇒ Object
58 |
# File 'lib/lutaml/formatter/base.rb', line 58 def format_class(_node); raise NotImplementedError; end |
#format_class_relationship(_node) ⇒ Object
56 |
# File 'lib/lutaml/formatter/base.rb', line 56 def format_class_relationship(_node); raise NotImplementedError; end |
#format_document(_node) ⇒ Object
60 |
# File 'lib/lutaml/formatter/base.rb', line 60 def format_document(_node); raise NotImplementedError; end |
#format_operation(_node) ⇒ Object
52 |
# File 'lib/lutaml/formatter/base.rb', line 52 def format_operation(_node); raise NotImplementedError; end |
#format_relationship(_node) ⇒ Object
54 |
# File 'lib/lutaml/formatter/base.rb', line 54 def format_relationship(_node); raise NotImplementedError; end |
#name ⇒ Object
rubocop:enable Rails/ActiveRecordAliases
28 29 30 |
# File 'lib/lutaml/formatter/base.rb', line 28 def name self.class.name end |