Class: ConfigScripts::Scripts::ScriptHistory
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ConfigScripts::Scripts::ScriptHistory
- Defined in:
- lib/config_scripts/scripts/script_history.rb
Overview
This class models a record of a script being run.
This uses the config_scripts
table to record its histories.
Instance Attribute Summary collapse
-
#name ⇒ String
The name of the script, which will be its timestamp.
Class Method Summary collapse
-
.entries_for_timestamp(timestamp) ⇒ Relation<ScriptHistory>
This method gets all of the entries that have a timestamp as their name.
-
.record_timestamp(timestamp) ⇒ ScriptHistory
This method records that we have run a script with a timestamp.
-
.remove_timestamp(timestamp) ⇒ Array<ScriptHistory>
This method removes all records that we have run a script with a timestamp.
-
.script_was_run?(timestamp) ⇒ Boolean
This method determines if we have run a script with a timestamp.
Instance Attribute Details
#name ⇒ String
The name of the script, which will be its timestamp.
|
# File 'lib/config_scripts/scripts/script_history.rb', line 9
|
Class Method Details
.entries_for_timestamp(timestamp) ⇒ Relation<ScriptHistory>
This method gets all of the entries that have a timestamp as their name.
15 16 17 |
# File 'lib/config_scripts/scripts/script_history.rb', line 15 def self.() self.where(:name => ) end |
.record_timestamp(timestamp) ⇒ ScriptHistory
This method records that we have run a script with a timestamp.
27 28 29 |
# File 'lib/config_scripts/scripts/script_history.rb', line 27 def self.() self.().first_or_create end |
.remove_timestamp(timestamp) ⇒ Array<ScriptHistory>
This method removes all records that we have run a script with a timestamp.
34 35 36 |
# File 'lib/config_scripts/scripts/script_history.rb', line 34 def self.() self.().destroy_all end |
.script_was_run?(timestamp) ⇒ Boolean
This method determines if we have run a script with a timestamp.
21 22 23 |
# File 'lib/config_scripts/scripts/script_history.rb', line 21 def self.script_was_run?() self.().any? end |