Sha256: 7d3a24a1b2c1d359e7009b715a254bf70f7d22c8d61c4bf07e675de016900b76

Contents?: true

Size: 613 Bytes

Versions: 34

Compression:

Stored size: 613 Bytes

Contents

# frozen_string_literal: true

module RailsAppGenerator
  # Utility methods
  class Util
    class << self
      # Log KeyValue pair
      #
      # @example
      #   Util.kv(:key, :value)
      def kv(label, value, len = 35)
        return ' ' * len if label.nil?

        label = label.to_s if label.is_a?(Symbol)
        label = label.length > len ? label.slice(0..len) : label.ljust(len, ' ')

        puts "#{label}: #{value}"
      end

      def line(heading, len = 80)
        heading = "- [ #{heading} ]"
        puts heading.length > len ? heading : heading.ljust(len, '-')
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
rails_app_generator-0.1.28 lib/rails_app_generator/util.rb
rails_app_generator-0.1.27 lib/rails_app_generator/util.rb
rails_app_generator-0.1.26 lib/rails_app_generator/util.rb
rails_app_generator-0.1.25 lib/rails_app_generator/util.rb
rails_app_generator-0.1.24 lib/rails_app_generator/util.rb
rails_app_generator-0.1.23 lib/rails_app_generator/util.rb
rails_app_generator-0.1.22 lib/rails_app_generator/util.rb
rails_app_generator-0.1.21 lib/rails_app_generator/util.rb
rails_app_generator-0.1.20 lib/rails_app_generator/util.rb
rails_app_generator-0.1.19 lib/rails_app_generator/util.rb
rails_app_generator-0.1.18 lib/rails_app_generator/util.rb
rails_app_generator-0.1.17 lib/rails_app_generator/util.rb
rails_app_generator-0.1.16 lib/rails_app_generator/util.rb
rails_app_generator-0.1.15 lib/rails_app_generator/util.rb
rails_app_generator-0.1.14 lib/rails_app_generator/util.rb
rails_app_generator-0.1.13 lib/rails_app_generator/util.rb
rails_app_generator-0.1.12 lib/rails_app_generator/util.rb
rails_app_generator-0.1.11 lib/rails_app_generator/util.rb
rails_app_generator-0.1.10 lib/rails_app_generator/util.rb
rails_app_generator-0.1.9 lib/rails_app_generator/util.rb