lib/facets/more/bitmask.rb in facets-1.3.3 vs lib/facets/more/bitmask.rb in facets-1.4.0
- old
+ new
@@ -1,41 +1,34 @@
-#--
-# Bitmask
+# = bitmask.rb
#
-# Copyright (c) 2005 George Moschovitis
+# == Copyright (c) 2005 George Moschovitis
#
-# Ruby License
+# Ruby License
#
-# This module is free software. You may use, modify, and/or redistribute this
-# software under the same terms as Ruby.
+# This module is free software. You may use, modify, and/or redistribute this
+# software under the same terms as Ruby.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.
#
-#================================================================================
-# ChangeLog
-#================================================================================
-# 05.11.25 trans Released.
-#================================================================================
-#++
+# == Authors and Contributors
+#
+# * Thomas Sawyer
-#:title: Bitmask
+# Author:: George Moschovitis
+# Copyright:: Copyright (c) 2005 George Moschovitis
+# License:: Ruby License
+
+# = Bitmask
#
# Bitmask extends the Integer class to allow for easy manipulation
# of a number as a bit field.
#
# 0xb0100.clear_bit(3) #=> 0
#
-#
-module Kernel
- def bitmask(bit)
- 1 << bit
- end
-end
-
class Integer
def set_bit(bit)
mask = (1 << bit)
self | mask
@@ -64,9 +57,16 @@
def test_bitmask(mask)
(self & mask) != 0
end
alias_method :bitmask?, :test_bitmask
+end
+
+
+module Kernel
+ def bitmask(bit)
+ 1 << bit
+ end
end
# _____ _
# |_ _|__ ___| |_