Sha256: 5810acfa3d80a9f355097838a9c50837d22a7be342844f9033d1cc5b89745946

Contents?: true

Size: 429 Bytes

Versions: 25

Compression:

Stored size: 429 Bytes

Contents

module Nugrant
  module Helper
    class Yaml
      def self.format(string, options = {})
        lines =  string.send(string.respond_to?(:lines) ? :lines : :to_s).to_a
        lines = lines.drop(1)

        if options[:indent]
          indent_text = " " * options[:indent]
          lines = lines.map do |line|
            indent_text + line
          end
        end

        return lines.join("")
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
nugrant-2.1.4 lib/nugrant/helper/yaml.rb
nugrant-2.1.3 lib/nugrant/helper/yaml.rb
nugrant-2.1.2 lib/nugrant/helper/yaml.rb
nugrant-2.1.1 lib/nugrant/helper/yaml.rb
nugrant-2.1.0 lib/nugrant/helper/yaml.rb
nugrant-2.0.2 lib/nugrant/helper/yaml.rb
nugrant-2.0.1 lib/nugrant/helper/yaml.rb
nugrant-2.0.0 lib/nugrant/helper/yaml.rb
nugrant-2.0.0.rc1 lib/nugrant/helper/yaml.rb
nugrant-2.0.0.pre2 lib/nugrant/helper/yaml.rb
nugrant-2.0.0.pre1 lib/nugrant/helper/yaml.rb
nugrant-1.4.2 lib/nugrant/helper/yaml.rb
nugrant-1.4.1 lib/nugrant/helper/yaml.rb
nugrant-1.4.0 lib/nugrant/helper/yaml.rb
nugrant-1.3.0 lib/nugrant/helper/yaml.rb
nugrant-1.2.0 lib/nugrant/helper/yaml.rb
nugrant-2.0.0.dev2 lib/nugrant/helper/yaml.rb
nugrant-2.0.0.dev1 lib/nugrant/helper/yaml.rb
nugrant-1.1.0 lib/nugrant/helper/yaml.rb
nugrant-1.0.1 lib/nugrant/helper/yaml.rb