Class: Ea::Qea::Models::EaAttribute

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/ea/qea/models/ea_attribute.rb

Overview

Represents an attribute from the t_attribute table in EA database This represents class attributes/properties

Constant Summary collapse

COLUMN_MAP =
{
  "Object_ID" => :ea_object_id,
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

from_db_row, #primary_key

Class Method Details

.column_mapObject



50
51
52
# File 'lib/ea/qea/models/ea_attribute.rb', line 50

def self.column_map
  COLUMN_MAP
end

.primary_key_columnObject



37
38
39
# File 'lib/ea/qea/models/ea_attribute.rb', line 37

def self.primary_key_column
  :id
end

.table_nameObject



41
42
43
# File 'lib/ea/qea/models/ea_attribute.rb', line 41

def self.table_name
  "t_attribute"
end

Instance Method Details

#allow_duplicates?Boolean

Check if attribute allows duplicates

Returns:

  • (Boolean)


74
75
76
# File 'lib/ea/qea/models/ea_attribute.rb', line 74

def allow_duplicates?
  allowduplicates == 1
end

#collection?Boolean

Check if attribute is a collection

Returns:

  • (Boolean)


62
63
64
# File 'lib/ea/qea/models/ea_attribute.rb', line 62

def collection?
  iscollection == 1
end

#constant?Boolean

Check if attribute is constant

Returns:

  • (Boolean)


80
81
82
# File 'lib/ea/qea/models/ea_attribute.rb', line 80

def constant?
  const == 1
end

#ordered?Boolean

Check if attribute is ordered

Returns:

  • (Boolean)


68
69
70
# File 'lib/ea/qea/models/ea_attribute.rb', line 68

def ordered?
  isordered == 1
end

#private?Boolean

Check if attribute is private

Returns:

  • (Boolean)


92
93
94
# File 'lib/ea/qea/models/ea_attribute.rb', line 92

def private?
  scope&.downcase == "private"
end

#protected?Boolean

Check if attribute is protected

Returns:

  • (Boolean)


98
99
100
# File 'lib/ea/qea/models/ea_attribute.rb', line 98

def protected?
  scope&.downcase == "protected"
end

#public?Boolean

Check if attribute is public

Returns:

  • (Boolean)


86
87
88
# File 'lib/ea/qea/models/ea_attribute.rb', line 86

def public?
  scope&.downcase == "public"
end

#sort_positionInteger

Returns pos for attribute ordering within parent.

Returns:

  • (Integer)

    pos for attribute ordering within parent



103
104
105
# File 'lib/ea/qea/models/ea_attribute.rb', line 103

def sort_position
  pos || 0
end

#static?Boolean

Check if attribute is static

Returns:

  • (Boolean)


56
57
58
# File 'lib/ea/qea/models/ea_attribute.rb', line 56

def static?
  isstatic == 1
end