Class: SystemTester::Step
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- SystemTester::Step
- Defined in:
- app/models/system_tester/step.rb
Constant Summary collapse
- INDENT =
" " * 6
Class Method Summary collapse
- .args ⇒ Object
- .bg_css ⇒ Object
- .friendly_type ⇒ Object
- .leafs ⇒ Object
- .parent_type ⇒ Object
- .parent_types ⇒ Object
- .text_css ⇒ Object
Instance Method Summary collapse
- #bg_css ⇒ Object
- #commented_title ⇒ Object
- #friendly_type ⇒ Object
- #module ⇒ Object
- #parent_type ⇒ Object
- #text_css ⇒ Object
Class Method Details
.args ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'app/models/system_tester/step.rb', line 65 def self.args [ { name: 'arg_one', label: 'One', type: 'text' }, { name: 'arg_two', label: 'Two', type: 'text' } ] end |
.bg_css ⇒ Object
37 38 39 |
# File 'app/models/system_tester/step.rb', line 37 def self.bg_css "teal" end |
.friendly_type ⇒ Object
29 30 31 |
# File 'app/models/system_tester/step.rb', line 29 def self.friendly_type name.demodulize end |
.leafs ⇒ Object
80 81 82 83 84 85 86 87 88 89 |
# File 'app/models/system_tester/step.rb', line 80 def self.leafs (descendants - direct_descendants).map do |desc| { name: desc.to_s, friendly: desc.friendly_type, parent: desc.parent_type, args: desc.args } end.sort_by { |step_type| [step_type[:parent_type], step_type[:friendly]] } end |
.parent_type ⇒ Object
33 34 35 |
# File 'app/models/system_tester/step.rb', line 33 def self.parent_type ancestors.fourth.name ? ancestors.fourth.name.demodulize : "Step" end |
.parent_types ⇒ Object
91 92 93 94 95 96 97 98 |
# File 'app/models/system_tester/step.rb', line 91 def self.parent_types direct_descendants.map do |desc| { name: desc.to_s, friendly: desc.friendly_type } end.sort_by { |step_type| step_type[:friendly] } end |
.text_css ⇒ Object
41 42 43 |
# File 'app/models/system_tester/step.rb', line 41 def self.text_css "white-text" end |
Instance Method Details
#bg_css ⇒ Object
53 54 55 |
# File 'app/models/system_tester/step.rb', line 53 def bg_css self.class.bg_css end |
#commented_title ⇒ Object
100 101 102 |
# File 'app/models/system_tester/step.rb', line 100 def commented_title title.split("\n").map { |line| "# #{line}" }.join("\n")[2..-1] end |
#friendly_type ⇒ Object
45 46 47 |
# File 'app/models/system_tester/step.rb', line 45 def friendly_type self.class.friendly_type end |
#module ⇒ Object
61 62 63 |
# File 'app/models/system_tester/step.rb', line 61 def module "" end |
#parent_type ⇒ Object
49 50 51 |
# File 'app/models/system_tester/step.rb', line 49 def parent_type self.class.parent_type end |
#text_css ⇒ Object
57 58 59 |
# File 'app/models/system_tester/step.rb', line 57 def text_css self.class.text_css end |