Module: SuperStack::LayerWrapper
Constant Summary collapse
- DEFAULT_LAYER_NAME =
'Unknown layer'
Instance Attribute Summary collapse
-
#file_name ⇒ Object
readonly
Returns the value of attribute file_name.
-
#priority ⇒ Object
Returns the value of attribute priority.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #has_file? ⇒ Boolean
- #inspect ⇒ Object
- #load(file_name, type = :yaml) ⇒ Object
- #name ⇒ Object
- #name=(name) ⇒ Object
Instance Attribute Details
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
10 11 12 |
# File 'lib/super_stack/layer_wrapper.rb', line 10 def file_name @file_name end |
#priority ⇒ Object
Returns the value of attribute priority.
10 11 12 |
# File 'lib/super_stack/layer_wrapper.rb', line 10 def priority @priority end |
Instance Method Details
#<=>(other) ⇒ Object
34 35 36 37 |
# File 'lib/super_stack/layer_wrapper.rb', line 34 def <=>(other) # For priorities, the smallest the higher self.priority <=> other.priority end |
#has_file? ⇒ Boolean
30 31 32 |
# File 'lib/super_stack/layer_wrapper.rb', line 30 def has_file? !@file_name.nil? end |
#inspect ⇒ Object
39 40 41 |
# File 'lib/super_stack/layer_wrapper.rb', line 39 def inspect "name: #{name}, priority: #{priority}, #{super}" end |
#load(file_name, type = :yaml) ⇒ Object
25 26 27 28 |
# File 'lib/super_stack/layer_wrapper.rb', line 25 def load(file_name, type = :yaml) raise 'Invalid file' unless File.readable? file_name load_from_yaml file_name if type == :yaml end |
#name ⇒ Object
21 22 23 |
# File 'lib/super_stack/layer_wrapper.rb', line 21 def name @name || DEFAULT_LAYER_NAME end |
#name=(name) ⇒ Object
17 18 19 |
# File 'lib/super_stack/layer_wrapper.rb', line 17 def name=(name) @name = name.to_s end |