Class: Temper::Base
- Inherits:
-
Object
- Object
- Temper::Base
- Defined in:
- lib/temper.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#original_filename ⇒ Object
Returns the value of attribute original_filename.
Instance Method Summary collapse
- #fingerprint ⇒ Object
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
-
#method_missing(method_name, *args, &block) ⇒ Object
:nodoc:.
- #respond_to?(*args) ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 |
# File 'lib/temper.rb', line 10 def initialize( = {}) raise RuntimeException, "No @storage set" unless @storage self.original_filename = [:original_filename] || ::File.basename(path) self.content_type = infer_content_type || "text/plain" end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
:nodoc:
24 25 26 |
# File 'lib/temper.rb', line 24 def method_missing(method_name, *args, &block) #:nodoc: @storage.__send__(method_name, *args, &block) end |
Instance Attribute Details
#content_type ⇒ Object
Returns the value of attribute content_type.
8 9 10 |
# File 'lib/temper.rb', line 8 def content_type @content_type end |
#original_filename ⇒ Object
Returns the value of attribute original_filename.
7 8 9 |
# File 'lib/temper.rb', line 7 def original_filename @original_filename end |
Instance Method Details
#fingerprint ⇒ Object
16 17 18 |
# File 'lib/temper.rb', line 16 def fingerprint @fingerprint ||= Digest::MD5.hexdigest(self.read) end |
#respond_to?(*args) ⇒ Boolean
20 21 22 |
# File 'lib/temper.rb', line 20 def respond_to?(*args) super or @storage.respond_to?(*args) end |