Sha256: 1bfcec15953d86582a35ad84fad9436fba8b58d8de7a7a2dd0647be6743da1fe

Contents?: true

Size: 847 Bytes

Versions: 4

Compression:

Stored size: 847 Bytes

Contents

require 'roar/decorator'
require 'roar/json/hal'
require 'pact_broker/api/pact_broker_urls'
require 'pact_broker/api/decorators/decorator_context'
require 'pact_broker/api/decorators/format_date_time'
require 'pact_broker/string_refinements'

module PactBroker
  module Api
    module Decorators
      class BaseDecorator < Roar::Decorator
        include Roar::JSON::HAL
        include Roar::JSON::HAL::Links
        include PactBroker::Api::PactBrokerUrls
        include FormatDateTime
        using PactBroker::StringRefinements

        def self.property(name, options={}, &block)
          if options.delete(:camelize)
            camelized_name = name.to_s.camelcase(false).to_sym
            super(name, { as: camelized_name }.merge(options), &block)
          else
            super
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pact_broker-2.79.1 lib/pact_broker/api/decorators/base_decorator.rb
pact_broker-2.79.0 lib/pact_broker/api/decorators/base_decorator.rb
pact_broker-2.78.1 lib/pact_broker/api/decorators/base_decorator.rb
pact_broker-2.78.0 lib/pact_broker/api/decorators/base_decorator.rb