Sha256: 8e20836cb2ab06bcbc704c6bb3a743453f7b36a2da7db124656ca249997dc629
Contents?: true
Size: 781 Bytes
Versions: 2
Compression:
Stored size: 781 Bytes
Contents
require 'allowance' module Happy module Extensions module Permissions module ContextExtensions extend ActiveSupport::Concern def permissions(&blk) (@permissions ||= Allowance::Permissions.new).tap do |p| if blk blk.arity == 0 ? p.instance_exec(&blk) : blk.call(p) end end end alias_method :can, :permissions end module ControllerExtensions extend ActiveSupport::Concern included do delegate :permissions, :can, :to => :context end end end end end Happy::Context.send(:include, Happy::Extensions::Permissions::ContextExtensions) Happy::Controller.send(:include, Happy::Extensions::Permissions::ControllerExtensions)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
happy-0.1.0.pre14 | lib/happy/ext/permissions.rb |
happy-0.1.0.pre13 | lib/happy/ext/permissions.rb |