Sha256: 3a6c9224b8bd72a39cf10610dcab0ef733eb630f1e77b152c6d7dda6b0f9b961

Contents?: true

Size: 604 Bytes

Versions: 1

Compression:

Stored size: 604 Bytes

Contents

# frozen_string_literal: true

module Remocon
  class Normalizer
    attr_reader :content

    def initialize(content, opts)
      @content = content.nil? ? opts[:default] : content
      @opts = opts
    end

    def process
      tap do
        raise Remocon::ValidationError, "#{self.class} is not satisfying normalizer" unless self.class.respond_symbol

        validate
        @content = normalize
      end
    end

    def validate
      # no-op
    end

    def normalize
      @content
    end

    def self.respond_symbol
      raise Remocon::UnsupportedTypeError, 'unknown'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
remocon-0.1.0 lib/remocon/normalizer/normalizer.rb