Class: Pineapples::Actions::Action
- Inherits:
-
Object
- Object
- Pineapples::Actions::Action
- Defined in:
- lib/pineapples/actions/base/action.rb
Direct Known Subclasses
Constant Summary collapse
- STATUS_COLORS =
{creative: :light_green, destructive: :light_red, neutral: :light_blue, warning: :light_yellow}
Instance Attribute Summary collapse
-
#colors ⇒ Object
readonly
Returns the value of attribute colors.
-
#generator ⇒ Object
readonly
Reference to AppGenerator instance.
-
#options ⇒ Object
Options hash.
Class Method Summary collapse
- .colors ⇒ Object
-
.inherited(child_class) ⇒ Object
Let status colors set by .status_color macro be inherited.
- .status_color(status, color) ⇒ Object
Instance Method Summary collapse
-
#initialize(generator, options = {}) ⇒ Action
constructor
A new instance of Action.
- #invoke! ⇒ Object
- #skip? ⇒ Boolean
Constructor Details
#initialize(generator, options = {}) ⇒ Action
Returns a new instance of Action.
31 32 33 34 |
# File 'lib/pineapples/actions/base/action.rb', line 31 def initialize(generator, = {}) @generator = generator = end |
Instance Attribute Details
#colors ⇒ Object (readonly)
Returns the value of attribute colors.
12 13 14 |
# File 'lib/pineapples/actions/base/action.rb', line 12 def colors @colors end |
#generator ⇒ Object (readonly)
Reference to AppGenerator instance
10 11 12 |
# File 'lib/pineapples/actions/base/action.rb', line 10 def generator @generator end |
#options ⇒ Object
Options hash
15 16 17 |
# File 'lib/pineapples/actions/base/action.rb', line 15 def end |
Class Method Details
.colors ⇒ Object
27 28 29 |
# File 'lib/pineapples/actions/base/action.rb', line 27 def self.colors @colors ||= {} end |
.inherited(child_class) ⇒ Object
Let status colors set by .status_color macro be inherited
18 19 20 21 |
# File 'lib/pineapples/actions/base/action.rb', line 18 def self.inherited(child_class) super child_class.instance_variable_set('@colors', self.colors) end |
.status_color(status, color) ⇒ Object
23 24 25 |
# File 'lib/pineapples/actions/base/action.rb', line 23 def self.status_color(status, color) colors[status] = color end |
Instance Method Details
#invoke! ⇒ Object
36 37 38 |
# File 'lib/pineapples/actions/base/action.rb', line 36 def invoke! raise NotImplementedError, "You should really implement invoke! method on Action subclasses" end |
#skip? ⇒ Boolean
40 41 42 43 |
# File 'lib/pineapples/actions/base/action.rb', line 40 def skip? @skip = false if @skip.nil? @skip end |