Sha256: 6e1e27d608bfdea09d98ccc05707bbfe24599ef16cf6a20291264c0e2894aacd
Contents?: true
Size: 836 Bytes
Versions: 8
Compression:
Stored size: 836 Bytes
Contents
module Flipper module Api module V1 module Decorators class Gate < SimpleDelegator # Public the gate being decorated alias_method :gate, :__getobj__ # Public: the value for the gate from the adapter. attr_reader :value def initialize(gate, value = nil) super gate @value = value end def as_json(exclude_name: false) as_json = { 'key' => gate.key.to_s, 'value' => value_as_json, } as_json['name'] = gate.name.to_s unless exclude_name as_json end private # json doesn't like sets def value_as_json data_type == :set ? value.to_a : value end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems