Class: FPM::Cookery::Source
- Inherits:
-
Object
- Object
- FPM::Cookery::Source
- Defined in:
- lib/fpm/cookery/source.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
Instance Method Summary collapse
-
#initialize(url, options = nil) ⇒ Source
constructor
A new instance of Source.
- #local? ⇒ Boolean
- #path ⇒ Object
- #provider? ⇒ Boolean
- #to_s ⇒ Object
- #to_str ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(url, options = nil) ⇒ Source
Returns a new instance of Source.
8 9 10 11 12 13 |
# File 'lib/fpm/cookery/source.rb', line 8 def initialize(url, = nil) ||= {} @url = Addressable::URI.parse(url.to_s) @provider = [:with] @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/fpm/cookery/source.rb', line 6 def @options end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
6 7 8 |
# File 'lib/fpm/cookery/source.rb', line 6 def provider @provider end |
Instance Method Details
#local? ⇒ Boolean
19 20 21 |
# File 'lib/fpm/cookery/source.rb', line 19 def local? @url.scheme.to_s.downcase == 'file' end |
#path ⇒ Object
27 28 29 |
# File 'lib/fpm/cookery/source.rb', line 27 def path @url.path end |
#provider? ⇒ Boolean
15 16 17 |
# File 'lib/fpm/cookery/source.rb', line 15 def provider? !!@provider end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/fpm/cookery/source.rb', line 31 def to_s @url.to_s end |
#to_str ⇒ Object
35 36 37 |
# File 'lib/fpm/cookery/source.rb', line 35 def to_str @url.to_s end |
#url ⇒ Object
23 24 25 |
# File 'lib/fpm/cookery/source.rb', line 23 def url @url.to_s end |