Module: SuperStack::LayerWrapper
- Includes:
- Comparable, MergePolicies::PolicyHandler
- Included in:
- Layer
- Defined in:
- lib/super_stack/layer_wrapper.rb
Constant Summary collapse
- DEFAULT_LAYER_NAME =
'Unknown layer'
Instance Attribute Summary collapse
-
#disabled ⇒ Object
(also: #disabled?)
readonly
Returns the value of attribute disabled.
-
#file_name ⇒ Object
readonly
Returns the value of attribute file_name.
-
#manager ⇒ Object
readonly
Returns the value of attribute manager.
-
#priority ⇒ Object
Returns the value of attribute priority.
Attributes included from MergePolicies::PolicyHandler
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #has_file? ⇒ Boolean
- #inspect ⇒ Object
- #load(file_name = self.file_name, type = :yaml) ⇒ Object
- #name ⇒ Object
- #name=(name) ⇒ Object
- #reload ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#disabled ⇒ Object (readonly) Also known as: disabled?
Returns the value of attribute disabled.
11 12 13 |
# File 'lib/super_stack/layer_wrapper.rb', line 11 def disabled @disabled end |
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
11 12 13 |
# File 'lib/super_stack/layer_wrapper.rb', line 11 def file_name @file_name end |
#manager ⇒ Object (readonly)
Returns the value of attribute manager.
11 12 13 |
# File 'lib/super_stack/layer_wrapper.rb', line 11 def manager @manager end |
#priority ⇒ Object
Returns the value of attribute priority.
11 12 13 |
# File 'lib/super_stack/layer_wrapper.rb', line 11 def priority @priority end |
Class Method Details
.from_hash(hash) ⇒ Object
56 57 58 |
# File 'lib/super_stack/layer_wrapper.rb', line 56 def self.from_hash(hash) hash.extend self end |
Instance Method Details
#<=>(other) ⇒ Object
41 42 43 44 |
# File 'lib/super_stack/layer_wrapper.rb', line 41 def <=>(other) # For priorities, the smallest the higher self.priority <=> other.priority end |
#has_file? ⇒ Boolean
37 38 39 |
# File 'lib/super_stack/layer_wrapper.rb', line 37 def has_file? !@file_name.nil? end |
#inspect ⇒ Object
46 47 48 49 50 |
# File 'lib/super_stack/layer_wrapper.rb', line 46 def inspect file_add_on = has_file? ? "file: '#{file_name}', " : '' priority_add_on = priority.nil? ? '' : "priority: #{priority}, " "{name: '#{name}', #{priority_add_on}#{file_add_on}#{super}}" end |
#load(file_name = self.file_name, type = :yaml) ⇒ Object
27 28 29 30 31 |
# File 'lib/super_stack/layer_wrapper.rb', line 27 def load(file_name=self.file_name, type = :yaml) raise "Cannot read file '#{file_name}'" unless File.readable? file_name load_from_yaml file_name if type == :yaml self end |
#name ⇒ Object
23 24 25 |
# File 'lib/super_stack/layer_wrapper.rb', line 23 def name @name || DEFAULT_LAYER_NAME end |
#name=(name) ⇒ Object
19 20 21 |
# File 'lib/super_stack/layer_wrapper.rb', line 19 def name=(name) @name = name.to_s end |
#reload ⇒ Object
33 34 35 |
# File 'lib/super_stack/layer_wrapper.rb', line 33 def reload self.load if has_file? end |
#to_s ⇒ Object
52 53 54 |
# File 'lib/super_stack/layer_wrapper.rb', line 52 def to_s inspect end |