Class: Attachie::Attachment
- Inherits:
-
Object
- Object
- Attachie::Attachment
- Defined in:
- lib/attachie.rb
Defined Under Namespace
Classes: Version
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#object ⇒ Object
Returns the value of attribute object.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(object, name, options) ⇒ Attachment
constructor
A new instance of Attachment.
- #inspect ⇒ Object
- #method_missing(method_name, *args, &block) ⇒ Object
- #respond_to_missing?(method_name, *args) ⇒ Boolean
- #version(version_name, opts = {}) ⇒ Object
- #versions ⇒ Object
Constructor Details
#initialize(object, name, options) ⇒ Attachment
Returns a new instance of Attachment.
123 124 125 126 127 |
# File 'lib/attachie.rb', line 123 def initialize(object, name, ) self.object = object self.name = name self. = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
139 140 141 142 143 |
# File 'lib/attachie.rb', line 139 def method_missing(method_name, *args, &block) return [method_name.to_sym] if .key?(method_name.to_sym) super end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
121 122 123 |
# File 'lib/attachie.rb', line 121 def name @name end |
#object ⇒ Object
Returns the value of attribute object.
121 122 123 |
# File 'lib/attachie.rb', line 121 def object @object end |
#options ⇒ Object
Returns the value of attribute options.
121 122 123 |
# File 'lib/attachie.rb', line 121 def @options end |
Instance Method Details
#inspect ⇒ Object
149 150 151 |
# File 'lib/attachie.rb', line 149 def inspect to_s end |
#respond_to_missing?(method_name, *args) ⇒ Boolean
145 146 147 |
# File 'lib/attachie.rb', line 145 def respond_to_missing?(method_name, *args) .key?(method_name.to_sym) end |
#version(version_name, opts = {}) ⇒ Object
129 130 131 132 133 |
# File 'lib/attachie.rb', line 129 def version(version_name, opts = {}) raise(NoSuchVersion, "No such version: #{version_name}") unless [:versions][version_name] Version.new self, version_name, opts end |
#versions ⇒ Object
135 136 137 |
# File 'lib/attachie.rb', line 135 def versions [:versions].collect { |version_name, _| version version_name } end |