lib/have-code/dm_code.rb in have-code-0.1.3 vs lib/have-code/dm_code.rb in have-code-0.2.0
- old
+ new
@@ -7,11 +7,11 @@
module ClassMethods
def have_code(mod, a, b)
write_inheritable_attribute :have_code_cipher, Affine::Cipher.new(mod, a, b)
extend OptionalClassMethods
- include InstanceMethods
+ include HaveCode::CommonCode::InstanceMethods
end
end
module OptionalClassMethods
def find_by_code(code)
@@ -21,19 +21,9 @@
object = self.get candidate_id
return object if object.code == code
return nil
rescue
nil
- end
- end
-
- module InstanceMethods
- def have_code_cipher
- self.class.read_inheritable_attribute :have_code_cipher
- end
-
- def code
- have_code_cipher.encipher(id).to_s(36)
end
end
end
end