expositor 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/expositor.rb +28 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e071ac2bc59b3c64efa6438ca50b62b5078f747f
|
4
|
+
data.tar.gz: fadbe24a3bcb960f6a4a57350be61e8f9c700ac8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a08d57632184f76640dac3346f04b614df6f0060072ba053122d2f155a0096a6807d6c0f2f5a8cb44ea7b96abc3a388d94c20de22ee2491193804ef9ef9edf78
|
7
|
+
data.tar.gz: 5b59e80ddc120f1199ffe698a34181c34b83eabec6f4c7bdfe91986af83d65b2a68845194edd80efac016d1aea624547769c8524e743d1e7041a19df6af7f5e7
|
data/lib/expositor.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module Expositor
|
2
|
+
def method_missing(method_name, *args, &block)
|
3
|
+
if expose_all? || valid_method?(method_name)
|
4
|
+
new(*args).send(method_name)
|
5
|
+
else
|
6
|
+
super
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def expose(only: nil, except: nil)
|
11
|
+
@only = only || []
|
12
|
+
@except = except || []
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def valid_method?(method_name)
|
18
|
+
if @only.empty?
|
19
|
+
!@except.include?(method_name)
|
20
|
+
else
|
21
|
+
@only.include?(method_name) && !@except.include?(method_name)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def expose_all?
|
26
|
+
@only.nil? && @except.nil?
|
27
|
+
end
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: expositor
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Volodya Sveredyuk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-02 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Exposit all object methods to it class
|
14
|
+
email: sveredyuk@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/expositor.rb
|
20
|
+
homepage: http://rubygems.org/gems/expositor
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.4.5.1
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Expositor will exposit!
|
44
|
+
test_files: []
|