Sha256: 1084e8f59bf22bc7a19e2714ea86485dae26697a20f99fd68e632c9bf8e481f6

Contents?: true

Size: 347 Bytes

Versions: 2

Compression:

Stored size: 347 Bytes

Contents

module Privileged
  module Actor
    def privilege(actor_method, resource_method, options = {})
      options = { :default => false }.merge(options) 
      define_method actor_method do |resource|
        return options[:default] unless resource.respond_to?(resource_method)
        resource.send(resource_method, self)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
privileged-0.1.1 lib/privileged.rb
privileged-0.1.0 lib/privileged.rb