### Home Classes Methods

### In Files

- lib/stella/core_ext.rb

### Parent

Object

### Methods

- #fineround
- #square
- #to_bytes
- #to_ms

### Included Modules

- Time::Units

### Files

- LICENSE.txt
- TODO

### Class/Module Index

Quicksearch

- Stella
- Stella::API
- Stella::API::Unauthorized
- Stella::Asserts
- Stella::CLI
- Stella::Client
- Stella::Common
- Stella::Common::PrivacyMethods
- Stella::ET
- Stella::Engine
- Stella::Engine::Base
- Stella::Engine::Base::ClassMethods
- Stella::Engine::Checkup
- Stella::EventTemplate
- Stella::ForcedRedirect
- Stella::HTTPError
- Stella::Log
- Stella::Log::HTTP
- Stella::PageError
- Stella::RT
- Stella::RepeatRequest
- Stella::Report
- Stella::Report::Content
- Stella::Report::Content::ReportMethods
- Stella::Report::Errors
- Stella::Report::Errors::ReportMethods
- Stella::Report::Headers
- Stella::Report::Metrics
- Stella::Report::Metrics::ReportMethods
- Stella::Report::Plugin
- Stella::Report::Plugin::ClassMethods
- Stella::Report::Statuses
- Stella::Report::Statuses::ReportMethods
- Stella::RequestError
- Stella::RequestTemplate
- Stella::Session
- Stella::StringTemplate
- Stella::TP
- Stella::Testplan
- Stella::Testplan::ClassMethods
- Stella::TestplanQuit
- Stella::Testrun
- Stella::TimeoutError
- Stella::UC
- Stella::Usecase
- Stella::Usecase::ClassMethods
- Stella::UsecaseError
- Stella::UsecaseFail
- Stella::Utils
- Stella::VERSION
- Addressable
- Addressable::URI
- Time
- Time::Units
- Array
- DefaultTestplan
- Float
- Hash
- MatchData
- MetricsPack
- Numeric
- Object
- OpenStruct
- StellaBehavior
- StellaError
- String
- Symbol
- Thread

No matching classes.

# Numeric

Statistics Module for Ruby (C) Derrick Pallas

Authors: Derrick Pallas Website: derrick.pallas.us/ruby-stats/ License: Academic Free License 3.0 Version: 2007-10-01b

### Public Instance Methods

fineround(len=6.0) click to toggle source

    # File lib/stella/core_ext.rb, line 389
    def fineround(len=6.0)
      v = (self * (10.0**len)).round / (10.0**len)
      v.zero? ? 0 : v
    end

square() click to toggle source

    # File lib/stella/core_ext.rb, line 388
    def square ; self * self ; end

to_bytes() click to toggle source

TODO: Use 1024?

    # File lib/stella/core_ext.rb, line 257
    def to_bytes
      args = case self.abs.to_i
      when (1000)..(1000**2)
        '%3.2f%s' % [(self / 1000.to_f).to_s, 'KB']
      when (1000**2)..(1000**3)
        '%3.2f%s' % [(self / (1000**2).to_f).to_s, 'MB']
      when (1000**3)..(1000**4)
        '%3.2f%s' % [(self / (1000**3).to_f).to_s, 'GB']
      when (1000**4)..(1000**6)
        '%3.2f%s' % [(self / (1000**4).to_f).to_s, 'TB']
      else
        [self.to_i, 'B'].join
      end
    end

to_ms() click to toggle source

    # File lib/stella/core_ext.rb, line 252
    def to_ms
      (self*1000.to_f)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.