Class: WeasyPrint::Source
- Inherits:
-
Object
- Object
- WeasyPrint::Source
- Defined in:
- lib/weasyprint/source.rb
Instance Method Summary collapse
- #file? ⇒ Boolean
- #html? ⇒ Boolean
-
#initialize(url_file_or_html) ⇒ Source
constructor
A new instance of Source.
- #to_s ⇒ Object
- #url? ⇒ Boolean
Constructor Details
#initialize(url_file_or_html) ⇒ Source
Returns a new instance of Source.
3 4 5 |
# File 'lib/weasyprint/source.rb', line 3 def initialize(url_file_or_html) @source = url_file_or_html end |
Instance Method Details
#file? ⇒ Boolean
11 12 13 |
# File 'lib/weasyprint/source.rb', line 11 def file? @source.kind_of?(File) end |
#html? ⇒ Boolean
15 16 17 |
# File 'lib/weasyprint/source.rb', line 15 def html? !(url? || file?) end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/weasyprint/source.rb', line 19 def to_s file? ? @source.path : @source end |
#url? ⇒ Boolean
7 8 9 |
# File 'lib/weasyprint/source.rb', line 7 def url? @source.is_a?(String) && @source.match(/\Ahttp/) end |