procto 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +1 -1
- data/lib/procto.rb +5 -7
- data/lib/procto/version.rb +1 -1
- data/spec/procto_spec.rb +4 -1
- metadata +1 -1
data/.travis.yml
CHANGED
data/lib/procto.rb
CHANGED
@@ -6,7 +6,7 @@ class Procto < Module
|
|
6
6
|
|
7
7
|
private_class_method :new
|
8
8
|
|
9
|
-
# Return a
|
9
|
+
# Return a module that turns the host into a method object
|
10
10
|
#
|
11
11
|
# @example without a name
|
12
12
|
#
|
@@ -40,28 +40,26 @@ class Procto < Module
|
|
40
40
|
#
|
41
41
|
# Printer.call('world') # => "Hello world"
|
42
42
|
#
|
43
|
-
# @param [
|
43
|
+
# @param [#to_sym] name
|
44
44
|
# the name of the instance method to call
|
45
45
|
#
|
46
46
|
# @return [Procto]
|
47
47
|
#
|
48
48
|
# @api public
|
49
49
|
def self.call(name = DEFAULT_NAME)
|
50
|
-
new(name)
|
50
|
+
new(name.to_sym)
|
51
51
|
end
|
52
52
|
|
53
53
|
# Initialize a new instance
|
54
54
|
#
|
55
|
-
# @param [Symbol
|
55
|
+
# @param [Symbol] name
|
56
56
|
# the name of the instance method to call
|
57
57
|
#
|
58
58
|
# @return [undefined]
|
59
59
|
#
|
60
60
|
# @api private
|
61
61
|
def initialize(name)
|
62
|
-
@block = ->(*args) {
|
63
|
-
new(*args).public_send(name)
|
64
|
-
}
|
62
|
+
@block = ->(*args) { new(*args).public_send(name) }
|
65
63
|
end
|
66
64
|
|
67
65
|
private
|
data/lib/procto/version.rb
CHANGED
data/spec/procto_spec.rb
CHANGED
@@ -35,9 +35,12 @@ describe Procto, '.call' do
|
|
35
35
|
context 'with a name' do
|
36
36
|
include_context 'procto'
|
37
37
|
|
38
|
+
let(:name) { double('name', to_sym: :print) }
|
39
|
+
|
38
40
|
let(:klass) do
|
41
|
+
method_name = name
|
39
42
|
Class.new do
|
40
|
-
include Procto.call(
|
43
|
+
include Procto.call(method_name)
|
41
44
|
|
42
45
|
def initialize(text)
|
43
46
|
@text = text
|