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



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

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



18
19
20
# File 'lib/lutaml/qea/models/ea_script.rb', line 18

def self.primary_key_column
  :script_id
end

.table_nameObject



22
23
24
# File 'lib/lutaml/qea/models/ea_script.rb', line 22

def self.table_name
  "t_script"
end

Instance Method Details

#debugging_script?Boolean

Check if this is a debugging script

Returns:

  • (Boolean)


51
52
53
# File 'lib/lutaml/qea/models/ea_script.rb', line 51

def debugging_script?
  script_category == "ScriptDebugging"
end

#has_content?Boolean

Check if script has content

Returns:

  • (Boolean)


57
58
59
# File 'lib/lutaml/qea/models/ea_script.rb', line 57

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

#has_notes?Boolean

Check if script has notes

Returns:

  • (Boolean)


63
64
65
# File 'lib/lutaml/qea/models/ea_script.rb', line 63

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