Class: Lutaml::Qea::Models::EaScript

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/lutaml/qea/models/ea_script.rb

Overview

Represents a script from the t_script table in EA database Stores behavioral scripts and debugging configurations

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#primary_key

Class Method Details

.from_db_row(row) ⇒ EaScript?

Create from database row

Parameters:

  • row (Hash)

    Database row with string keys

Returns:

  • (EaScript, nil)

    New instance or nil if row is nil



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/lutaml/qea/models/ea_script.rb', line 28

def self.from_db_row(row)
  return nil if row.nil?

  new(
    script_id: row["ScriptID"],
    script_category: row["ScriptCategory"],
    script_name: row["ScriptName"],
    script_author: row["ScriptAuthor"],
    notes: row["Notes"],
    script: row["Script"],
  )
end

.primary_key_columnObject



16
17
18
# File 'lib/lutaml/qea/models/ea_script.rb', line 16

def self.primary_key_column
  :script_id
end

.table_nameObject



20
21
22
# File 'lib/lutaml/qea/models/ea_script.rb', line 20

def self.table_name
  "t_script"
end

Instance Method Details

#debugging_script?Boolean

Check if this is a debugging script

Returns:

  • (Boolean)


49
50
51
# File 'lib/lutaml/qea/models/ea_script.rb', line 49

def debugging_script?
  script_category == "ScriptDebugging"
end

#has_content?Boolean

Check if script has content

Returns:

  • (Boolean)


55
56
57
# File 'lib/lutaml/qea/models/ea_script.rb', line 55

def has_content?
  !script.nil? && !script.empty?
end

#has_notes?Boolean

Check if script has notes

Returns:

  • (Boolean)


61
62
63
# File 'lib/lutaml/qea/models/ea_script.rb', line 61

def has_notes?
  !notes.nil? && !notes.empty?
end