Class: HtmlCssToImage::Data::Image
- Inherits:
-
Object
- Object
- HtmlCssToImage::Data::Image
- Defined in:
- lib/html_css_to_image/data/image.rb
Instance Attribute Summary collapse
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(url:) ⇒ Image
constructor
A new instance of Image.
Constructor Details
#initialize(url:) ⇒ Image
Returns a new instance of Image.
14 15 16 17 18 19 20 21 |
# File 'lib/html_css_to_image/data/image.rb', line 14 def initialize(url:) url = URI(url) raise ArgumentError.new "Not https" unless url.scheme == HtmlCssToImage::API_SCHEME raise ArgumentError.new "Not HCTI API" unless url.host == HtmlCssToImage::API_HOST @url = url end |
Instance Attribute Details
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/html_css_to_image/data/image.rb', line 6 def url @url end |
Class Method Details
Instance Method Details
#id ⇒ Object
23 24 25 26 27 28 |
# File 'lib/html_css_to_image/data/image.rb', line 23 def id url = @url.to_s i = url.rindex('/') + 1 url[i..-1] end |