Skip to content

Commit

Permalink
Merge pull request whomwah#5 from metaskills/core_ext
Browse files Browse the repository at this point in the history
Proper namespace CoreExtensions and only extend when needed.
  • Loading branch information
whomwah committed Sep 1, 2011
2 parents f24c975 + fda6d4d commit 7016b5d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/rqrcode/core_ext/array.rb
@@ -1,5 +1,5 @@
require 'rqrcode/core_ext/array/behavior'

class Array #:nodoc:
include CoreExtensions::Array::Behavior
include RQRCode::CoreExtensions::Array::Behavior
end
13 changes: 8 additions & 5 deletions lib/rqrcode/core_ext/array/behavior.rb
@@ -1,9 +1,12 @@
module CoreExtensions #:nodoc:
module Array #:nodoc:
module Behavior
def extract_options!
last.is_a?(::Hash) ? pop : {}
module RQRCode
module CoreExtensions #:nodoc:
module Array #:nodoc:
module Behavior
def extract_options!
last.is_a?(::Hash) ? pop : {}
end unless [].respond_to?(:extract_options!)
end
end
end
end

2 changes: 1 addition & 1 deletion lib/rqrcode/core_ext/integer.rb
@@ -1,5 +1,5 @@
require 'rqrcode/core_ext/integer/bitwise'

class Integer #:nodoc:
include CoreExtensions::Integer::Bitwise
include RQRCode::CoreExtensions::Integer::Bitwise
end
14 changes: 8 additions & 6 deletions lib/rqrcode/core_ext/integer/bitwise.rb
@@ -1,9 +1,11 @@
module CoreExtensions #:nodoc:
module Integer #:nodoc:
module Bitwise
def rszf(count)
# zero fill right shift
(self >> count) & ((2 ** ((self.size * 8) - count))-1)
module RQRCode
module CoreExtensions #:nodoc:
module Integer #:nodoc:
module Bitwise
def rszf(count)
# zero fill right shift
(self >> count) & ((2 ** ((self.size * 8) - count))-1)
end
end
end
end
Expand Down

0 comments on commit 7016b5d

Please sign in to comment.