Sha256: 7cdf254fbe7cd7818731f71521849513e18cab0725cc3f42f66e573bf3ba1d43

Contents?: true

Size: 883 Bytes

Versions: 26

Compression:

Stored size: 883 Bytes

Contents

module Hobo
  module Routes
    extend self

    def reset_linkables
      @linkable_keys = Set.new
    end

    def linkable_key(klass, action, options)
      subsite = options[:subsite] || options['subsite']
      method  = options[:method]  || options['method'] || :get
      [ subsite, klass.name, action, method ].join('/')
    end

    def linkable!(klass, action, options={})
      @linkable_keys << linkable_key(klass, action, options)
    end

    def linkable?(klass, action, options={})
      #raise Hobo::Error, "deprecated"
      @linkable_keys.member? linkable_key(klass, action, options)
    end

    def models_with(wanted_action)
      raise Hobo::Error, "deprecated"
      @linkable_keys.map do |k|
        subsite, class_name, action, method = k.split('/')
        (action == wanted_action.to_s) ? class_name.constantize : nil
      end.compact
    end

  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
hobo-2.2.6 lib/hobo/routes.rb
hobo-2.2.5 lib/hobo/routes.rb
hobo-2.2.4 lib/hobo/routes.rb
hobo-2.2.3 lib/hobo/routes.rb
hobo-2.2.2 lib/hobo/routes.rb
hobo-2.2.1 lib/hobo/routes.rb
hobo-2.2.0 lib/hobo/routes.rb
hobo-2.1.2 lib/hobo/routes.rb
hobo-2.1.1 lib/hobo/routes.rb
hobo-2.1.0 lib/hobo/routes.rb
hobo-2.1.0.pre4 lib/hobo/routes.rb
hobo-2.1.0.pre3 lib/hobo/routes.rb
hobo-2.1.0.pre2 lib/hobo/routes.rb
hobo-2.1.0.pre1 lib/hobo/routes.rb
hobo-2.0.1 lib/hobo/routes.rb
hobo-2.0.0 lib/hobo/routes.rb
hobo-2.0.0.pre10 lib/hobo/routes.rb
hobo-2.0.0.pre9 lib/hobo/routes.rb
hobo-2.0.0.pre8 lib/hobo/routes.rb
hobo-2.0.0.pre7 lib/hobo/routes.rb