Sha256: 14708c04f7520839ec2e9fc9889c18a36a0ccf45c56b042e3735fcf108ea859e
Contents?: true
Size: 608 Bytes
Versions: 1
Compression:
Stored size: 608 Bytes
Contents
require_relative 'core' module ActsAsHashids module Methods extend ActiveSupport::Concern module ClassMethods def acts_as_hashids(options = {}) include ActsAsHashids::Core unless ancestors.include?(ActsAsHashids::Core) define_singleton_method :hashids_secret do secret = options[:secret] (secret.respond_to?(:call) ? instance_exec(&secret) : secret) || base_class.name end define_singleton_method :hashids do length = options[:length] || 8 Hashids.new(hashids_secret, length) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
acts_as_hashids-0.1.2 | lib/acts_as_hashids/methods.rb |