Class: Pancake::BootLoaderMixin::Base
- Defined in:
- lib/pancake/bootloaders.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
:api: :public.
Class Method Summary collapse
-
.call(config) ⇒ Object
Creates a new instance and runs it :api: private.
-
.options ⇒ Object
Provides access to the bootloader options :api: private.
-
.options=(opts = {}) ⇒ Object
Sets options for the bootloder By including conditions in the bootloader when you declare it You can selectively run bootloaders later :api: private.
-
.run?(conditions = {}) ⇒ Boolean
Checks the conditions with the options of the bootloader To see if this one should be run Only the central bootloaders with the conditions will be checked :api: private.
Instance Method Summary collapse
-
#initialize(config) ⇒ Base
constructor
A new instance of Base.
- #stack ⇒ Object
- #stack_class ⇒ Object
Constructor Details
#initialize(config) ⇒ Base
Returns a new instance of Base.
34 35 36 |
# File 'lib/pancake/bootloaders.rb', line 34 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object
:api: :public
7 8 9 |
# File 'lib/pancake/bootloaders.rb', line 7 def config @config end |
Class Method Details
.call(config) ⇒ Object
Creates a new instance and runs it :api: private
40 41 42 |
# File 'lib/pancake/bootloaders.rb', line 40 def self.call(config) new(config).run! end |
.options ⇒ Object
Provides access to the bootloader options :api: private
20 21 22 |
# File 'lib/pancake/bootloaders.rb', line 20 def self. # :nodoc: @options ||= {} end |
.options=(opts = {}) ⇒ Object
Sets options for the bootloder By including conditions in the bootloader when you declare it You can selectively run bootloaders later :api: private
13 14 15 16 |
# File 'lib/pancake/bootloaders.rb', line 13 def self.(opts={}) # :nodoc: @options = opts @options[:level] ||= :default end |
.run?(conditions = {}) ⇒ Boolean
Checks the conditions with the options of the bootloader To see if this one should be run Only the central bootloaders with the conditions will be checked :api: private
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/pancake/bootloaders.rb', line 48 def self.run?(conditions = {}) opts = if conditions.keys.include?(:only) return conditions[:only].all?{|k,v| opts[k] == v} end if conditions.keys.include?(:except) return conditions[:except].all?{|k,v| opts[k] != v} end true end |
Instance Method Details
#stack ⇒ Object
24 25 26 27 |
# File 'lib/pancake/bootloaders.rb', line 24 def stack raise "No Stack Configured" unless @config[:stack] @config[:stack] end |
#stack_class ⇒ Object
29 30 31 32 |
# File 'lib/pancake/bootloaders.rb', line 29 def stack_class raise "No Stack Class Configured" unless @config[:stack_class] @config[:stack_class] end |