Class: Reefer::Pad

Inherits:
Object
  • Object
show all
Defined in:
lib/reefer/pad.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Pad

Returns a new instance of Pad.

Raises:



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/reefer/pad.rb', line 10

def initialize(url)
  url = URI.parse(url)
  @domain = url.host
  @name = url.path

  # remove the leading slash (which is always present), but explode
  # if any more are present. pad names can't contain them.
  @name.gsub!(/^\//, "")
  raise InvalidPadName\
    if @name.index("/")
end

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



8
9
10
# File 'lib/reefer/pad.rb', line 8

def domain
  @domain
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/reefer/pad.rb', line 8

def name
  @name
end

Instance Method Details

#revision(version) ⇒ Object



22
23
24
# File 'lib/reefer/pad.rb', line 22

def revision(version)
  Revision.new(self, version)
end

#to_htmlObject



26
27
28
# File 'lib/reefer/pad.rb', line 26

def to_html
  revision(:latest).to_html
end