Class: Numeric

Inherits:
Object show all
Defined in:
opal/fron/core_ext/numeric.rb

Overview

Numeric

Instance Method Summary collapse

Instance Method Details

#clamp(min, max) ⇒ Numeric

Clamps itself between two values

Parameters:

  • min (Numeric)

    The minimum value

  • max (Numeric)

    The maximum value

Returns:



9
10
11
# File 'opal/fron/core_ext/numeric.rb', line 9

def clamp(min, max)
  [[self, max].min, min].max
end

#emString

Returns the em representation

Returns:



23
24
25
# File 'opal/fron/core_ext/numeric.rb', line 23

def em
  "#{self}em"
end

#pxString

Returns the px representation

Returns:



16
17
18
# File 'opal/fron/core_ext/numeric.rb', line 16

def px
  "#{round}px"
end