Class: Decking::Image
- Inherits:
-
Object
- Object
- Decking::Image
- Extended by:
- Helpers, Enumerable
- Includes:
- Helpers
- Defined in:
- lib/decking/images.rb
Constant Summary
Constants included from Helpers
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
- .[](name) ⇒ Object
- .add(params) ⇒ Object
- .each(&block) ⇒ Object
-
.images ⇒ Object
def delete_all ; map{|n, c| c.delete }; end def delete_all!; map{|n, c| c.delete! }; end.
- .instances ⇒ Object
Instance Method Summary collapse
-
#initialize(name, params) ⇒ Image
constructor
A new instance of Image.
- #method_missing(method, *args, &block) ⇒ Object
Methods included from Helpers
clear_progressline, run_with_progress, run_with_threads_multiplexed
Constructor Details
#initialize(name, params) ⇒ Image
Returns a new instance of Image.
35 36 37 38 |
# File 'lib/decking/images.rb', line 35 def initialize name, params @name = name @config = params end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/decking/images.rb', line 40 def method_missing method, *args, &block if config.key? method config[method] else super end end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
33 34 35 |
# File 'lib/decking/images.rb', line 33 def config @config end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
33 34 35 |
# File 'lib/decking/images.rb', line 33 def name @name end |
Class Method Details
.[](name) ⇒ Object
24 25 26 |
# File 'lib/decking/images.rb', line 24 def [](name) instances[name] ||= new(name, @images[name]) end |
.add(params) ⇒ Object
19 20 21 22 |
# File 'lib/decking/images.rb', line 19 def add params images.update params.name => params self[params.name] end |
.each(&block) ⇒ Object
28 29 30 |
# File 'lib/decking/images.rb', line 28 def each &block @instances.each(&block) end |
.images ⇒ Object
def delete_all ; map{|n, c| c.delete }; end def delete_all!; map{|n, c| c.delete! }; end
11 12 13 |
# File 'lib/decking/images.rb', line 11 def images @images ||= Hash.new end |
.instances ⇒ Object
15 16 17 |
# File 'lib/decking/images.rb', line 15 def instances @instances ||= Hash.new end |