methods 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1a00020e759e6a949a08c27b12700d4746866d6
4
- data.tar.gz: e628b64ebddf574c8e13dc3dc5b76a7d6439896d
3
+ metadata.gz: 116a11c112805575fb7ee666e893977ca3aad47e
4
+ data.tar.gz: 8a5426be6438a7229f4c2910280729df19047920
5
5
  SHA512:
6
- metadata.gz: 25b4fb3b3423c2c2ee7587fec06a3518afbc38e4dc0bf839a2ded2201936d3a046cb6ae6f789f1d12ccd9a362b217ae123ae94dc2665a222976a8605e1a41261
7
- data.tar.gz: 02c8da5e16fd73fd6a5b415b7d41e201c7297d778a9ab2b67e090631af1375c557ec93eb79c8423985c52d7ca8afa39c73210f25ff3400839f044f6a23115672
6
+ metadata.gz: 64bf970a298760113d33f396b0ca4508e159e1bc8b06530e3c4a36cf1b37af35aed9dab9c6012962a3e91488c885284616d3639b26c746c7d799f507c2cabdf5
7
+ data.tar.gz: a95f776467744c25ef019891f97b7b1191d9dbbe2ff281e30170268bffe385ef0e7c8611d553fde53f70f1106e682de24595dcbd3aa6b63a3526fb2ee5529248
@@ -1,6 +1,7 @@
1
1
  require "methods/version"
2
2
  require 'binding_of_caller'
3
3
  require "methods/methods_wrapper"
4
+ require "methods/instance_methods_wrapper"
4
5
  require "methods/method_without_args"
5
6
 
6
7
  module Methods
@@ -0,0 +1,15 @@
1
+ module Methods
2
+ class InstanceMethodsWrapper < BasicObject
3
+ def initialize(obj)
4
+ @obj = obj
5
+ end
6
+
7
+ def method_missing(method)
8
+ @obj.instance_method(method)
9
+ end
10
+
11
+ def respond_to_missing?(*args)
12
+ true
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,19 @@
1
1
  module Methods
2
2
  module MethodWithoutArgs
3
+ module ClassMethods
4
+ def instance_method(*args)
5
+ if args.empty?
6
+ Methods::InstanceMethodsWrapper.new(self)
7
+ else
8
+ super
9
+ end
10
+ end
11
+ end
12
+
13
+ def self.included(base)
14
+ base.extend(ClassMethods)
15
+ end
16
+
3
17
  def method(*args)
4
18
  if args.empty?
5
19
  Methods::MethodsWrapper.new(self)
@@ -1,3 +1,3 @@
1
1
  module Methods
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: methods
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artur Roszczyk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-15 00:00:00.000000000 Z
11
+ date: 2018-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: binding_of_caller
@@ -84,6 +84,7 @@ files:
84
84
  - bin/console
85
85
  - bin/setup
86
86
  - lib/methods.rb
87
+ - lib/methods/instance_methods_wrapper.rb
87
88
  - lib/methods/method_without_args.rb
88
89
  - lib/methods/methods_wrapper.rb
89
90
  - lib/methods/version.rb