Sha256: e667b09f3dbc3dcecaf9a9ba735bb706782d30d065434d1c1c07e7048c3bdd31
Contents?: true
Size: 646 Bytes
Versions: 17
Compression:
Stored size: 646 Bytes
Contents
# encoding: utf-8 require "logstash/json" module LogStash::Api::AppHelpers def respond_with(data, options={}) as = options.fetch(:as, :json) pretty = params.has_key?("pretty") if as == :json content_type "application/json" LogStash::Json.dump(data, {:pretty => pretty}) else content_type "text/plain" data.to_s end end def as_boolean(string) return true if string == true || string =~ (/(true|t|yes|y|1)$/i) return false if string == false || string.blank? || string =~ (/(false|f|no|n|0)$/i) raise ArgumentError.new("invalid value for Boolean: \"#{string}\"") end end
Version data entries
17 entries across 17 versions & 1 rubygems