• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ruby-smart / support / #8

03 Jul 2024 08:24PM UTC coverage: 99.083%. Remained the same
#8

push

gonzo4711
## [1.5.0] - 2024-07-03
* **[add]** `RubySmart::Support::ThreadInfo.debugger?`-detection to determinate if a **Debugger** gem is active
* **[fix]** `String#to_boolean`-method to detect false-values (which makes all other values become true - similar to `::ActiveRecord::Type::Boolean`)

3 of 3 new or added lines in 2 files covered. (100.0%)

216 of 218 relevant lines covered (99.08%)

71.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/lib/ruby_smart/support/core_ext/ruby/float.rb
1
# frozen_string_literal: true
2

3
unless Float.method_defined? :round_down
1✔
4
  class Float
1✔
5
    # returns a new float and rounds down
6
    #
7
    # @example
8
    #   nb = 45.5678
9
    #   nb.round_down(2)
10
    #   > 45.56
11
    #
12
    # @param [Integer] exp - amount of decimals
13
    # @return [Float] rounded number
14
    def round_down(exp = 0)
1✔
15
      multiplier = 10 ** exp
2✔
16
      ((self * multiplier).floor).to_f/multiplier.to_f
2✔
17
    end
18
  end
19
end
20

21
unless Float.method_defined? :round_up
1✔
22
  class Float
1✔
23
    # returns a new float and rounds up
24
    #
25
    # @example
26
    #   nb = 45.5678
27
    #   nb.round_up(2)
28
    #   > 45.57
29
    #
30
    # @param [Integer] exp - amount of decimals
31
    # @return [Float] rounded number
32
    def round_up(exp = 0)
1✔
33
      multiplier = 10 ** exp
2✔
34
      ((self * multiplier).ceil).to_f/multiplier.to_f
2✔
35
    end
36
  end
37
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc