Sha256: 5271ce16f651dfc6532e7cd4de8fa959e7ecd3ee11b6f2a438d186d42b90ee75

Contents?: true

Size: 493 Bytes

Versions: 5

Compression:

Stored size: 493 Bytes

Contents

module Grape
  class Entity
    module Exposure
      class FormatterBlockExposure < Base
        attr_reader :format_with

        def setup(&format_with)
          @format_with = format_with
        end

        def dup
          super(&@format_with)
        end

        def ==(other)
          super && @format_with == other.format_with
        end

        def value(entity, _options)
          entity.exec_with_attribute(attribute, &@format_with)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
grape-entity-0.6.1 lib/grape_entity/exposure/formatter_block_exposure.rb
grape-entity-0.6.0 lib/grape_entity/exposure/formatter_block_exposure.rb
grape-entity-0.5.2 lib/grape_entity/exposure/formatter_block_exposure.rb
grape-entity-0.5.1 lib/grape_entity/exposure/formatter_block_exposure.rb
grape-entity-0.5.0 lib/grape_entity/exposure/formatter_block_exposure.rb