Last active
August 15, 2017 05:49
-
-
Save s-ashwinkumar/70decb8711f55c8b5523f711484d616c to your computer and use it in GitHub Desktop.
Revisions
-
s-ashwinkumar revised this gist
Aug 15, 2017 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ def new_method2 def method_missing(name, *args, &block) super unless @@old_methods.keys.include?(name.to_sym) warn "WARNING : #{name} will be deprecated with next release dated 09/01/2017" send(@@old_methods[name.to_sym]) end @@ -21,12 +21,12 @@ def method_missing(name, *args, &block) obj = Myclass.new # => #<Myclass:0x0000000271c288> obj.oldMethod1 #WARNING : oldMethod1 will be deprecated with next release dated 09/01/2017 # => "Myclass#new_method1" obj.new_method1 # =>"Myclass#new_method1" obj.oldMethod2 #WARNING : oldMethod2 will be deprecated with next release dated 09/01/2017 # => "Myclass#new_method2" obj.non_existant_method #NoMethodError: undefined method `non_existant_method' for #<Myclass:0x0000000271c288> -
s-ashwinkumar revised this gist
Aug 15, 2017 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ class Myclass @@old_methods = { oldMethod1: :new_method1, oldMethod2: :new_method2 } def new_method1 'Myclass#new_method1' @@ -20,13 +20,13 @@ def method_missing(name, *args, &block) obj = Myclass.new # => #<Myclass:0x0000000271c288> obj.oldMethod1 #oldMethod1 will be deprecated with next release dated 09/01/2017 # => "Myclass#new_method1" obj.new_method1 # =>"Myclass#new_method1" obj.oldMethod2 #oldMethod2 will be deprecated with next release dated 09/01/2017 # => "Myclass#new_method2" obj.non_existant_method #NoMethodError: undefined method `non_existant_method' for #<Myclass:0x0000000271c288> -
s-ashwinkumar revised this gist
Aug 15, 2017 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ class Myclass @@old_methods = { old_method1: :new_method1, old_method2: :new_method2 } def new_method1 'Myclass#new_method1' @@ -10,13 +10,14 @@ def new_method2 end def method_missing(name, *args, &block) super unless @@old_methods.keys.include?(name.to_sym) warn "#{name} will be deprecated with next release dated 09/01/2017" send(@@old_methods[name.to_sym]) end end obj = Myclass.new # => #<Myclass:0x0000000271c288> obj.old_method1 -
s-ashwinkumar revised this gist
Aug 15, 2017 . No changes.There are no files selected for viewing
-
s-ashwinkumar revised this gist
Aug 15, 2017 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +0,0 @@ -
s-ashwinkumar created this gist
Aug 15, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ class Myclass @@old_methods = {:old_mehod1 old_method2) def new_method1 'Myclass#new_method1' end def new_method2 'Myclass#new_method2' end def method_missing(name, *args, &block) super unless @@old_methods.include?(name) warn "#{name} will be deprecated with next release dated 09/01/2017" send(name.to_sym) end end obj = Myclass.new # => #<Myclass:0x0000000271c288> obj.old_method1 #old_method1 will be deprecated with next release dated 09/01/2017 # => "Myclass#new_method1" obj.new_method1 # =>"Myclass#new_method1" obj.old_method2 #old_method2 will be deprecated with next release dated 09/01/2017 # => "Myclass#new_method2" obj.non_existant_method #NoMethodError: undefined method `non_existant_method' for #<Myclass:0x0000000271c288> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ class Myclass end