Class: Integer

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/mootool/core_extensions.rb

Overview

rubocop:disable Style/Documentation

Instance Method Summary collapse

Instance Method Details

#align(alignment = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/mootool/core_extensions.rb', line 13

def align(alignment = nil)
  alignment ||= 4

  return self if T.must(alignment) < 2

  alignment = T.must(alignment) - 1

  if (self & alignment).zero?
    self
  else
    (self | alignment) + 1
  end
end