Sha256: b4a62694c8384b3052f4a2a49e7d4e1382dfedf02e24aed81300b8059ffb8995

Contents?: true

Size: 541 Bytes

Versions: 1

Compression:

Stored size: 541 Bytes

Contents

module Rambo
  module RamlModels
    class Headers
      attr_accessor :headers

      def initialize(headers)
        @headers = headers
      end

      def add(hash)
        headers.merge!(hash)
        self
      end

      def merge!(other)
        add(other.headers)
      end

      def pretty
        beginning = "{\n"
        ending    = "}"

        contents = headers.to_a.map {|pair|
          "\t\"#{pair.first}\" => \"#{pair.last}\"\n"
        }

        "#{beginning}#{contents.join("")}#{ending}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rambo_ruby-0.3.0 lib/rambo/raml_models/headers.rb