Class: FiddleFart::Jsbin
- Inherits:
-
Object
- Object
- FiddleFart::Jsbin
- Defined in:
- lib/fiddle_fart/jsbin.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#revision ⇒ Object
Returns the value of attribute revision.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json ⇒ Object
- #edit_link ⇒ Object
- #embed_url ⇒ Object
-
#initialize(attrs = {}) ⇒ Jsbin
constructor
A new instance of Jsbin.
- #share_link ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Jsbin
Returns a new instance of Jsbin.
5 6 7 |
# File 'lib/fiddle_fart/jsbin.rb', line 5 def initialize(attrs={}) attrs.each { |k,v| instance_variable_set("@#{k}", v) } end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/fiddle_fart/jsbin.rb', line 3 def id @id end |
#revision ⇒ Object
Returns the value of attribute revision.
3 4 5 |
# File 'lib/fiddle_fart/jsbin.rb', line 3 def revision @revision end |
Class Method Details
.parse(url) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/fiddle_fart/jsbin.rb', line 9 def self.parse(url) obj = self.new host, domain, id, revision = url.scan(/([^\/^:]+)/).flatten obj.id = id obj.revision = revision obj end |
Instance Method Details
#as_json ⇒ Object
29 30 31 |
# File 'lib/fiddle_fart/jsbin.rb', line 29 def as_json super end |
#edit_link ⇒ Object
21 22 23 |
# File 'lib/fiddle_fart/jsbin.rb', line 21 def edit_link "http://jsbin.com/eVIyOTE/#{@id}/#{@revision}/edit" end |
#embed_url ⇒ Object
25 26 27 |
# File 'lib/fiddle_fart/jsbin.rb', line 25 def "http://jsbin.com/#{@id}/#{@revision}/embed" end |
#share_link ⇒ Object
17 18 19 |
# File 'lib/fiddle_fart/jsbin.rb', line 17 def share_link "http://jsbin.com/eVIyOTE/#{@id}/#{@revision}/" end |