Sha256: ce55633a2dd78f9956d450b4356e3666508ecb8db6bc0ed43998a2820d80c448

Contents?: true

Size: 514 Bytes

Versions: 34

Compression:

Stored size: 514 Bytes

Contents

module TreasureData
  module Helpers
    module_function

    def format_with_delimiter(number, delimiter = ',')
      num = number.to_s
      if formatted = num.gsub!(/(\d)(?=(?:\d{3})+(?!\d))/, "\\1#{delimiter}")
        formatted
      else
        num
      end
    end

    def home_directory
      on_windows? ? ENV['USERPROFILE'].gsub("\\","/") : ENV['HOME']
    end

    def on_windows?
      RUBY_PLATFORM =~ /mswin32|mingw32/
    end

    def on_mac?
      RUBY_PLATFORM =~ /-darwin\d/
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
td-0.11.9 lib/td/helpers.rb
td-0.11.8.2 lib/td/helpers.rb
td-0.11.8.1 lib/td/helpers.rb
td-0.11.8 lib/td/helpers.rb
td-0.11.7 lib/td/helpers.rb
td-0.11.6 lib/td/helpers.rb
td-0.11.5 lib/td/helpers.rb
td-0.11.4 lib/td/helpers.rb
td-0.11.3 lib/td/helpers.rb
td-0.11.2 lib/td/helpers.rb
td-0.11.1 lib/td/helpers.rb
td-0.10.99 lib/td/helpers.rb
td-0.10.98 lib/td/helpers.rb
td-0.10.97 lib/td/helpers.rb
td-0.10.96 lib/td/helpers.rb
td-0.10.95 lib/td/helpers.rb
td-0.10.94 lib/td/helpers.rb
td-0.10.93 lib/td/helpers.rb
td-0.10.92 lib/td/helpers.rb
td-0.10.91 lib/td/helpers.rb