Class: Grendel::Link

Inherits:
Object
  • Object
show all
Defined in:
lib/grendel/link.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document, user, params = {}) ⇒ Link

Returns a new instance of Link.



5
6
7
8
9
10
11
12
# File 'lib/grendel/link.rb', line 5

def initialize(document, user, params = {})
  params = Mash.new(params)
  @document = document
  @user = user
  @uri = params[:uri] ?
    URI.parse(params[:uri]).path :
    "/links/" + @user.id # escape this?
end

Instance Attribute Details

#documentObject

Returns the value of attribute document.



3
4
5
# File 'lib/grendel/link.rb', line 3

def document
  @document
end

#uriObject

Returns the value of attribute uri.



3
4
5
# File 'lib/grendel/link.rb', line 3

def uri
  @uri
end

#userObject

Returns the value of attribute user.



3
4
5
# File 'lib/grendel/link.rb', line 3

def user
  @user
end