Class: Thumbor::Cascade
- Inherits:
-
Object
- Object
- Thumbor::Cascade
- Extended by:
- Forwardable
- Defined in:
- lib/thumbor/cascade.rb
Constant Summary collapse
- FILTER_REGEX =
Regexp.new('^(.+)_filter$')
Instance Attribute Summary collapse
-
#crypto ⇒ Object
Returns the value of attribute crypto.
-
#filters ⇒ Object
Returns the value of attribute filters.
-
#image ⇒ Object
Returns the value of attribute image.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(key = nil, image = nil) ⇒ Cascade
constructor
A new instance of Cascade.
- #method_missing(method, *args) ⇒ Object
- #respond_to_missing?(method, include_private = false) ⇒ Boolean
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/thumbor/cascade.rb', line 49 def method_missing(method, *args) if method =~ FILTER_REGEX @filters << "#{FILTER_REGEX.match(method)[1]}(#{escape_args(args).join(',')})" self else super end end |
Instance Attribute Details
#crypto ⇒ Object
Returns the value of attribute crypto.
11 12 13 |
# File 'lib/thumbor/cascade.rb', line 11 def crypto @crypto end |
#filters ⇒ Object
Returns the value of attribute filters.
11 12 13 |
# File 'lib/thumbor/cascade.rb', line 11 def filters @filters end |
#image ⇒ Object
Returns the value of attribute image.
11 12 13 |
# File 'lib/thumbor/cascade.rb', line 11 def image @image end |
#options ⇒ Object
Returns the value of attribute options.
11 12 13 |
# File 'lib/thumbor/cascade.rb', line 11 def @options end |
Instance Method Details
#generate ⇒ Object
45 46 47 |
# File 'lib/thumbor/cascade.rb', line 45 def generate @crypto.generate (@options).merge({ image: @image, filters: @filters }) end |
#respond_to_missing?(method, include_private = false) ⇒ Boolean
58 59 60 |
# File 'lib/thumbor/cascade.rb', line 58 def respond_to_missing?(method, include_private = false) method =~ FILTER_REGEX || super end |