Sha256: b4d0985aada3d7088533f09418949626c83075c7630bcf5a20c082e8828c0a21
Contents?: true
Size: 420 Bytes
Versions: 2
Compression:
Stored size: 420 Bytes
Contents
module Ostiary class Policy attr_reader :name, :method, :actions def initialize(name, actions = [], method: nil) @name = name @method = method @actions = actions end def inspect "#{name}" end def met?(_action, &block) return yield name unless method method.call end def error_message(action) "#{action} requires #{name}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ostiary-0.16.0 | lib/ostiary/policy.rb |
ostiary-0.15.0 | lib/ostiary/policy.rb |