Class: Embedit::Image
- Inherits:
-
Object
- Object
- Embedit::Image
- Defined in:
- lib/embedit/providers/image.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #html(options = {}) ⇒ Object
-
#initialize(url) ⇒ Image
constructor
A new instance of Image.
Constructor Details
#initialize(url) ⇒ Image
7 8 9 |
# File 'lib/embedit/providers/image.rb', line 7 def initialize(url) @url = url end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
5 6 7 |
# File 'lib/embedit/providers/image.rb', line 5 def format @format end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/embedit/providers/image.rb', line 5 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/embedit/providers/image.rb', line 5 def url @url end |
Class Method Details
.match(url) ⇒ Object
18 19 20 |
# File 'lib/embedit/providers/image.rb', line 18 def self.match(url) url.match(/(.+\.(gif|jpg|png)$)/) end |
Instance Method Details
#html(options = {}) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/embedit/providers/image.rb', line 11 def html( = {}) attributes = .collect {|k,v| "#{k}=\"#{v}\" "}.join(" ") %{ <a href="#{@url}"><img src="#{@url}" #{attributes}/></a> } end |