Sha256: 01f84994a0e56aa098b5aff035cdce9f99f76d3e82c1390d3e80453676792aab
Contents?: true
Size: 662 Bytes
Versions: 14
Compression:
Stored size: 662 Bytes
Contents
module JSONAPIonify::Api class Context def initialize(readonly: false, persisted: false, existing_context: nil, &block) @readonly = readonly @persisted = persisted @existing_context = existing_context @block = block end def call(instance, delegate) existing_context = @existing_context || proc {} existing_block = proc { existing_context.call(instance, delegate) } block = @block || proc {} instance.instance_exec(delegate, existing_block, &block) end def readonly? !!@readonly end def persisted? !!@persisted end end end
Version data entries
14 entries across 14 versions & 1 rubygems