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
14
# File 'lib/fpm/cookery/source.rb', line 8

def initialize(url, options = nil)
  options ||= {}

  @url = URI(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)


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

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

#pathObject



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

def path
  @url.path
end

#provider?Boolean

Returns:

  • (Boolean)


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

def provider?
  !!@provider
end

#to_sObject



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

def to_s
  @url.to_s
end

#to_strObject



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

def to_str
  @url.to_s
end

#urlObject



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

def url
  @url.to_s
end