Sha256: 8045721e1851380f0156d5447778ef3334c2e396f7297e7110f467377869f000
Contents?: true
Size: 494 Bytes
Versions: 1
Compression:
Stored size: 494 Bytes
Contents
require 'arpg/roles/version' require 'active_support/concern' module ARPG module Roles extend ActiveSupport::Concern class_methods do def roles(*roles, on: :roles) klass = (class << self; self; end) roles.each do |role| klass.send(:define_method, role) do where("'#{role}' = ANY(#{on})") end define_method(:"#{role}?") do send(on).include?(role.to_s) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
arpg-roles-0.0.1 | lib/arpg/roles.rb |