Class: Hbc::URL

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
Library/Homebrew/cask/lib/hbc/url.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, options = {}) ⇒ URL



16
17
18
19
20
21
22
23
24
25
# File 'Library/Homebrew/cask/lib/hbc/url.rb', line 16

def initialize(uri, options = {})
  @uri        = URI(uri)
  @user_agent = options.fetch(:user_agent, :default)
  @cookies    = options[:cookies]
  @referer    = options[:referer]
  @using      = options[:using]
  @revision   = options[:revision]
  @trust_cert = options[:trust_cert]
  @data       = options[:data]
end

Instance Attribute Details

#cookiesObject (readonly)

Returns the value of attribute cookies



3
4
5
# File 'Library/Homebrew/cask/lib/hbc/url.rb', line 3

def cookies
  @cookies
end

#dataObject (readonly)

Returns the value of attribute data



3
4
5
# File 'Library/Homebrew/cask/lib/hbc/url.rb', line 3

def data
  @data
end

#refererObject (readonly)

Returns the value of attribute referer



3
4
5
# File 'Library/Homebrew/cask/lib/hbc/url.rb', line 3

def referer
  @referer
end

#revisionObject (readonly)

Returns the value of attribute revision



3
4
5
# File 'Library/Homebrew/cask/lib/hbc/url.rb', line 3

def revision
  @revision
end

#trust_certObject (readonly)

Returns the value of attribute trust_cert



3
4
5
# File 'Library/Homebrew/cask/lib/hbc/url.rb', line 3

def trust_cert
  @trust_cert
end

#uriObject (readonly)

Returns the value of attribute uri



3
4
5
# File 'Library/Homebrew/cask/lib/hbc/url.rb', line 3

def uri
  @uri
end

#user_agentObject (readonly)

Returns the value of attribute user_agent



3
4
5
# File 'Library/Homebrew/cask/lib/hbc/url.rb', line 3

def user_agent
  @user_agent
end

#usingObject (readonly)

Returns the value of attribute using



3
4
5
# File 'Library/Homebrew/cask/lib/hbc/url.rb', line 3

def using
  @using
end

Class Method Details

.from(*args, &block) ⇒ Object



8
9
10
11
12
13
14
# File 'Library/Homebrew/cask/lib/hbc/url.rb', line 8

def self.from(*args, &block)
  if block_given?
    Hbc::DSL::StanzaProxy.once(self) { new(*block.call) }
  else
    new(*args)
  end
end