Class: Shrine::Derivation::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/shrine/plugins/derivation_endpoint.rb

Direct Known Subclasses

Delete, Generate, Opened, Processed, Response, Retrieve, Upload, Url

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(derivation) ⇒ Command

Returns a new instance of Command.


277
278
279
# File 'lib/shrine/plugins/derivation_endpoint.rb', line 277

def initialize(derivation)
  @derivation = derivation
end

Instance Attribute Details

#derivationObject (readonly)

Returns the value of attribute derivation.


275
276
277
# File 'lib/shrine/plugins/derivation_endpoint.rb', line 275

def derivation
  @derivation
end

Class Method Details

.delegate(*names) ⇒ Object

Creates methods that delegate to derivation parameters.


282
283
284
285
286
287
288
289
290
291
292
# File 'lib/shrine/plugins/derivation_endpoint.rb', line 282

def self.delegate(*names)
  names.each do |name|
    protected define_method(name) {
      if [:name, :args, :source].include?(name)
        derivation.public_send(name)
      else
        derivation.option(name)
      end
    }
  end
end