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
-
#fetchable? ⇒ Boolean
If the Addressable::URI is empty, there’s nothing to fetch.
-
#initialize(url, options = nil) ⇒ Source
constructor
A new instance of Source.
- #local? ⇒ Boolean
- #path ⇒ Object
- #provider? ⇒ Boolean
- #url ⇒ Object
Constructor Details
#initialize(url, options = nil) ⇒ Source
Returns a new instance of Source.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fpm/cookery/source.rb', line 9 def initialize(url, = nil) ||= {} begin @url = Addressable::URI.parse(url.to_s) rescue Addressable::URI::InvalidURIError @url = URI::SshGit.parse(url.to_s) end @provider = [:with] = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/fpm/cookery/source.rb', line 7 def end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
7 8 9 |
# File 'lib/fpm/cookery/source.rb', line 7 def provider @provider end |
Instance Method Details
#fetchable? ⇒ Boolean
If the Addressable::URI is empty, there’s nothing to fetch
29 30 31 |
# File 'lib/fpm/cookery/source.rb', line 29 def fetchable? !@url.to_s.empty? end |
#local? ⇒ Boolean
24 25 26 |
# File 'lib/fpm/cookery/source.rb', line 24 def local? @url.scheme.to_s.downcase == 'file' end |
#path ⇒ Object
38 39 40 |
# File 'lib/fpm/cookery/source.rb', line 38 def path @url.path end |
#provider? ⇒ Boolean
20 21 22 |
# File 'lib/fpm/cookery/source.rb', line 20 def provider? !!@provider end |
#url ⇒ Object
33 34 35 |
# File 'lib/fpm/cookery/source.rb', line 33 def url @url.to_s end |