Class: FPM::Cookery::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/fpm/cookery/source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options = nil)
  options ||= {}
  @url = Addressable::URI.parse(url.to_s)
  @provider = options[:with]
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/fpm/cookery/source.rb', line 6

def options
  @options
end

#providerObject (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

Returns:

  • (Boolean)


19
20
21
# File 'lib/fpm/cookery/source.rb', line 19

def local?
  @url.scheme.to_s.downcase == 'file'
end

#pathObject



27
28
29
# File 'lib/fpm/cookery/source.rb', line 27

def path
  @url.path
end

#provider?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/fpm/cookery/source.rb', line 15

def provider?
  !!@provider
end

#to_sObject



31
32
33
# File 'lib/fpm/cookery/source.rb', line 31

def to_s
  @url.to_s
end

#to_strObject



35
36
37
# File 'lib/fpm/cookery/source.rb', line 35

def to_str
  @url.to_s
end

#urlObject



23
24
25
# File 'lib/fpm/cookery/source.rb', line 23

def url
  @url.to_s
end