Class: Noodall::Permalink

Inherits:
Array
  • Object
show all
Defined in:
lib/noodall/permalink.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Permalink

Returns a new instance of Permalink.



3
4
5
6
7
8
9
# File 'lib/noodall/permalink.rb', line 3

def initialize(*args)
  if args.length > 1
    super args
  else
    super args.first.to_s.split('/')
  end
end

Class Method Details

.from_mongo(value) ⇒ Object



23
24
25
# File 'lib/noodall/permalink.rb', line 23

def self.from_mongo(value)
  new( *value.to_s.split('/') ) 
end

.to_mongo(value) ⇒ Object



19
20
21
# File 'lib/noodall/permalink.rb', line 19

def self.to_mongo(value)
  value.to_s
end

Instance Method Details

#inspectObject



15
16
17
# File 'lib/noodall/permalink.rb', line 15

def inspect
  "<Permalink #{self.to_s}>"
end

#to_sObject



11
12
13
# File 'lib/noodall/permalink.rb', line 11

def to_s
  self.join('/')
end