Class: Bresson::ImageReference
- Inherits:
-
Object
- Object
- Bresson::ImageReference
- Defined in:
- lib/bresson/image_reference.rb
Instance Attribute Summary collapse
-
#item ⇒ Object
Returns the value of attribute item.
-
#legend ⇒ Object
Returns the value of attribute legend.
-
#link ⇒ Object
Returns the value of attribute link.
Instance Method Summary collapse
-
#initialize(args) ⇒ ImageReference
constructor
A new instance of ImageReference.
- #method_missing(name, *args) ⇒ Object
- #thumb ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(args) ⇒ ImageReference
Returns a new instance of ImageReference.
5 6 7 8 9 |
# File 'lib/bresson/image_reference.rb', line 5 def initialize args @item = eval "Bresson::#{args[:source]}.new" @link = args[:link] @legend = args[:legend] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
11 12 13 |
# File 'lib/bresson/image_reference.rb', line 11 def method_missing name, *args eval "@item.#{name}(args)" end |
Instance Attribute Details
#item ⇒ Object
Returns the value of attribute item.
3 4 5 |
# File 'lib/bresson/image_reference.rb', line 3 def item @item end |
#legend ⇒ Object
Returns the value of attribute legend.
3 4 5 |
# File 'lib/bresson/image_reference.rb', line 3 def legend @legend end |
#link ⇒ Object
Returns the value of attribute link.
3 4 5 |
# File 'lib/bresson/image_reference.rb', line 3 def link @link end |
Instance Method Details
#thumb ⇒ Object
15 16 17 |
# File 'lib/bresson/image_reference.rb', line 15 def thumb @link.split(".com/").join(".com/thumb/") end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/bresson/image_reference.rb', line 19 def to_s '{"reference":"upload","source":"'+@item.class.to_s.split('::').last+'","link":"'+@link+'"}' end |