Class: Lutaml::Qea::Models::EaAttribute
- Defined in:
- lib/lutaml/qea/models/ea_attribute.rb
Overview
Represents an attribute from the t_attribute table in EA database This represents class attributes/properties
Class Method Summary collapse
-
.from_db_row(row) ⇒ EaAttribute?
Create from database row.
- .primary_key_column ⇒ Object
- .table_name ⇒ Object
Instance Method Summary collapse
-
#allow_duplicates? ⇒ Boolean
Check if attribute allows duplicates.
-
#collection? ⇒ Boolean
Check if attribute is a collection.
-
#constant? ⇒ Boolean
Check if attribute is constant.
-
#ordered? ⇒ Boolean
Check if attribute is ordered.
-
#private? ⇒ Boolean
Check if attribute is private.
-
#protected? ⇒ Boolean
Check if attribute is protected.
-
#public? ⇒ Boolean
Check if attribute is public.
-
#static? ⇒ Boolean
Check if attribute is static.
Methods inherited from BaseModel
Class Method Details
.from_db_row(row) ⇒ EaAttribute?
Create from database row
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/lutaml/qea/models/ea_attribute.rb', line 51 def self.from_db_row(row) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength return nil if row.nil? new( ea_object_id: row["Object_ID"], name: row["Name"], scope: row["Scope"], stereotype: row["Stereotype"], containment: row["Containment"], isstatic: row["IsStatic"], iscollection: row["IsCollection"], isordered: row["IsOrdered"], allowduplicates: row["AllowDuplicates"], lowerbound: row["LowerBound"], upperbound: row["UpperBound"], container: row["Container"], notes: row["Notes"], derived: row["Derived"], id: row["ID"], pos: row["Pos"], genoption: row["GenOption"], length: row["Length"], precision: row["Precision"], scale: row["Scale"], const: row["Const"], style: row["Style"], classifier: row["Classifier"], default: row["Default"], type: row["Type"], ea_guid: row["ea_guid"], styleex: row["StyleEx"], ) end |
.primary_key_column ⇒ Object
39 40 41 |
# File 'lib/lutaml/qea/models/ea_attribute.rb', line 39 def self.primary_key_column :id end |
.table_name ⇒ Object
43 44 45 |
# File 'lib/lutaml/qea/models/ea_attribute.rb', line 43 def self.table_name "t_attribute" end |
Instance Method Details
#allow_duplicates? ⇒ Boolean
Check if attribute allows duplicates
105 106 107 |
# File 'lib/lutaml/qea/models/ea_attribute.rb', line 105 def allow_duplicates? allowduplicates == 1 end |
#collection? ⇒ Boolean
Check if attribute is a collection
93 94 95 |
# File 'lib/lutaml/qea/models/ea_attribute.rb', line 93 def collection? iscollection == 1 end |
#constant? ⇒ Boolean
Check if attribute is constant
111 112 113 |
# File 'lib/lutaml/qea/models/ea_attribute.rb', line 111 def constant? const == 1 end |
#ordered? ⇒ Boolean
Check if attribute is ordered
99 100 101 |
# File 'lib/lutaml/qea/models/ea_attribute.rb', line 99 def ordered? isordered == 1 end |
#private? ⇒ Boolean
Check if attribute is private
123 124 125 |
# File 'lib/lutaml/qea/models/ea_attribute.rb', line 123 def private? scope&.downcase == "private" end |
#protected? ⇒ Boolean
Check if attribute is protected
129 130 131 |
# File 'lib/lutaml/qea/models/ea_attribute.rb', line 129 def protected? scope&.downcase == "protected" end |
#public? ⇒ Boolean
Check if attribute is public
117 118 119 |
# File 'lib/lutaml/qea/models/ea_attribute.rb', line 117 def public? scope&.downcase == "public" end |
#static? ⇒ Boolean
Check if attribute is static
87 88 89 |
# File 'lib/lutaml/qea/models/ea_attribute.rb', line 87 def static? isstatic == 1 end |