Sha256: a4f60622782fb12a598f99429f49c85dc98a88d8b6fe67245b814b36fa1fee25

Contents?: true

Size: 393 Bytes

Versions: 12

Compression:

Stored size: 393 Bytes

Contents

module Evil::Client::Formatter
  #
  # Utility module to format data as a single text
  #
  module Text
    extend self

    # Formats data as a text
    #
    # @param  [Object] source
    # @return [String]
    #
    def call(source)
      case source
      when File, Tempfile then source.read
      when StringIO       then source.string
      else source.to_s
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
evil-client-3.2.0 lib/evil/client/formatter/text.rb
evil-client-3.1.0 lib/evil/client/formatter/text.rb
evil-client-3.0.4 lib/evil/client/formatter/text.rb
evil-client-3.0.3 lib/evil/client/formatter/text.rb
evil-client-3.0.2 lib/evil/client/formatter/text.rb
evil-client-3.0.1 lib/evil/client/formatter/text.rb
evil-client-3.0.0 lib/evil/client/formatter/text.rb
evil-client-2.1.1 lib/evil/client/formatter/text.rb
evil-client-2.1.0 lib/evil/client/formatter/text.rb
evil-client-2.0.0 lib/evil/client/formatter/text.rb
evil-client-1.1.0 lib/evil/client/formatter/text.rb
evil-client-1.0.0 lib/evil/client/formatter/text.rb