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.4.5 lib/noodall/permalink.rb
noodall-core-0.4.3 lib/noodall/permalink.rb
noodall-core-0.4.2 lib/noodall/permalink.rb
noodall-core-0.4.0 lib/noodall/permalink.rb
noodall-core-0.3.12 lib/noodall/permalink.rb
noodall-core-0.3.11 lib/noodall/permalink.rb
noodall-core-0.3.10 lib/noodall/permalink.rb
noodall-core-0.3.9 lib/noodall/permalink.rb
noodall-core-0.3.8 lib/noodall/permalink.rb
noodall-core-0.3.7 lib/noodall/permalink.rb
noodall-core-0.3.6 lib/noodall/permalink.rb
noodall-core-0.3.5 lib/noodall/permalink.rb
noodall-core-0.3.4 lib/noodall/permalink.rb
noodall-core-0.3.3 lib/noodall/permalink.rb
noodall-core-0.3.2 lib/noodall/permalink.rb
noodall-core-0.3.1 lib/noodall/permalink.rb
noodall-core-0.3.0 lib/noodall/permalink.rb
noodall-core-0.2.1 lib/noodall/permalink.rb
noodall-core-0.2.0 lib/noodall/permalink.rb
noodall-core-0.1.4 lib/noodall/permalink.rb