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