Sha256: 4c3ce384a18b47f519ae003a2e0ee55d42bc280bed51515b4aa8273d331048ba
Contents?: true
Size: 1.59 KB
Versions: 1
Compression:
Stored size: 1.59 KB
Contents
# frozen_string_literal: true module Azeroth class Decorator # @api private # @author Darthjee # # Resource buiilding options for decorator # # @see https://www.rubydoc.info/gems/sinclair/1.6.4/Sinclair/Options # Sinclair::Options class Options < Sinclair::Options DEFAULT_OPTIONS = { as: nil, if: nil, decorator: nil }.freeze with_options DEFAULT_OPTIONS # @method as # @api private # # key to use when exposing the field # # when nil, the name of the field # # @return [Symbol,String] # @method if # @api private # # conditional to be checked when exposing field # # when conditional returns false, the # field will not be exposed # # when if is a Proc the proc will be used, # when it is a Symbol or String this will be # the name of the method called in the decorator # to evaluate the condition # # @return [Proc,Symbol] # @method decorator # @api private # # Decorator class to decorate the value # # when false {DummyDecorator} will be used # # when nil, a decorator will be infered from # value::Decorator # # @return [NilClass,Decorator] # @api private # # Returns true when attribute must can be decorated # # when false, decoration happens through # #as_json call on value # # @return [TrueClass,FalseClass] def any_decorator? decorator != false end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
azeroth-0.6.3 | lib/azeroth/decorator/options.rb |