Sha256: 418e53c2ddb69e356f4c24ecc55d261ea8a14940060a916b1d2336741751001d

Contents?: true

Size: 428 Bytes

Versions: 44

Compression:

Stored size: 428 Bytes

Contents

module Noodall
  class Permalink < Array
    def initialize(*args)
      if args.length > 1
        super args
      else
        super args.first.to_s.split('/')
      end
    end

    def to_s
      self.join('/')
    end

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

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

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
noodall-core-0.8.2 lib/noodall/permalink.rb
noodall-core-0.8.1 lib/noodall/permalink.rb
noodall-core-0.8.0 lib/noodall/permalink.rb
noodall-core-0.7.5 lib/noodall/permalink.rb
noodall-core-0.7.3 lib/noodall/permalink.rb
noodall-core-0.7.2 lib/noodall/permalink.rb
noodall-core-0.6.3 lib/noodall/permalink.rb
noodall-core-0.6.2 lib/noodall/permalink.rb
noodall-core-0.6.1 lib/noodall/permalink.rb
noodall-core-0.5.7 lib/noodall/permalink.rb
noodall-core-0.6.0 lib/noodall/permalink.rb
noodall-core-0.5.6 lib/noodall/permalink.rb
noodall-core-0.5.5 lib/noodall/permalink.rb
noodall-core-0.5.4 lib/noodall/permalink.rb
noodall-core-0.5.3 lib/noodall/permalink.rb
noodall-core-0.5.1 lib/noodall/permalink.rb
noodall-core-0.5.0 lib/noodall/permalink.rb
noodall-core-0.4.8 lib/noodall/permalink.rb
noodall-core-0.4.7 lib/noodall/permalink.rb
noodall-core-0.4.6 lib/noodall/permalink.rb