method_struct 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +3 -3
- data/lib/method_struct.rb +4 -2
- data/lib/method_struct/version.rb +1 -1
- metadata +82 -61
- checksums.yaml +0 -15
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -29,8 +29,8 @@ Say you have this:
|
|
29
29
|
|
30
30
|
You can change it into this:
|
31
31
|
|
32
|
-
class Registrator < MethodStruct.new(:
|
33
|
-
def
|
32
|
+
class Registrator < MethodStruct.new(:email, :name)
|
33
|
+
def call
|
34
34
|
create_user!
|
35
35
|
send_email!
|
36
36
|
end
|
@@ -47,7 +47,7 @@ You can change it into this:
|
|
47
47
|
|
48
48
|
class UsersController
|
49
49
|
def create
|
50
|
-
Registrator.
|
50
|
+
Registrator.call(params[:email], params[:name])
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
data/lib/method_struct.rb
CHANGED
@@ -3,8 +3,10 @@ require "method_struct/version"
|
|
3
3
|
module MethodStruct
|
4
4
|
def self.new(*fields)
|
5
5
|
Class.new do
|
6
|
-
|
7
|
-
|
6
|
+
class << self
|
7
|
+
define_method(:call) do |*field_values|
|
8
|
+
new(*field_values).call
|
9
|
+
end
|
8
10
|
end
|
9
11
|
|
10
12
|
define_method(:initialize) do |*values|
|
metadata
CHANGED
@@ -1,64 +1,76 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: method_struct
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
5
11
|
platform: ruby
|
6
|
-
authors:
|
7
|
-
-
|
12
|
+
authors:
|
13
|
+
- "Pawe\xC5\x82 Obrok"
|
8
14
|
autorequire:
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
17
|
+
|
18
|
+
date: 2013-07-15 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
14
22
|
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ~>
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.3'
|
20
|
-
type: :development
|
21
23
|
prerelease: false
|
22
|
-
|
23
|
-
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
24
27
|
- - ~>
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
- - ! '>='
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 9
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 3
|
33
|
+
version: "1.3"
|
34
34
|
type: :development
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake
|
35
38
|
prerelease: false
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
- - ! '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
48
|
type: :development
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: rspec
|
49
52
|
prerelease: false
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
type: :development
|
63
|
+
version_requirements: *id003
|
55
64
|
description: Facilitates extracting methods into separate objects
|
56
|
-
email:
|
65
|
+
email:
|
57
66
|
- pawel.obrok@gmail.com
|
58
67
|
executables: []
|
68
|
+
|
59
69
|
extensions: []
|
70
|
+
|
60
71
|
extra_rdoc_files: []
|
61
|
-
|
72
|
+
|
73
|
+
files:
|
62
74
|
- .gitignore
|
63
75
|
- Gemfile
|
64
76
|
- LICENSE.txt
|
@@ -68,30 +80,39 @@ files:
|
|
68
80
|
- lib/method_struct/version.rb
|
69
81
|
- method_struct.gemspec
|
70
82
|
- spec/method_struct_spec.rb
|
83
|
+
has_rdoc: true
|
71
84
|
homepage: https://github.com/basecrm/method_struct
|
72
|
-
licenses:
|
85
|
+
licenses:
|
73
86
|
- MIT
|
74
|
-
metadata: {}
|
75
87
|
post_install_message:
|
76
88
|
rdoc_options: []
|
77
|
-
|
89
|
+
|
90
|
+
require_paths:
|
78
91
|
- lib
|
79
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
hash: 3
|
98
|
+
segments:
|
99
|
+
- 0
|
100
|
+
version: "0"
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
hash: 3
|
107
|
+
segments:
|
108
|
+
- 0
|
109
|
+
version: "0"
|
89
110
|
requirements: []
|
111
|
+
|
90
112
|
rubyforge_project:
|
91
|
-
rubygems_version:
|
113
|
+
rubygems_version: 1.6.2
|
92
114
|
signing_key:
|
93
|
-
specification_version:
|
115
|
+
specification_version: 3
|
94
116
|
summary: Facilitates extracting methods into separate objects
|
95
|
-
test_files:
|
117
|
+
test_files:
|
96
118
|
- spec/method_struct_spec.rb
|
97
|
-
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
NzkyNTk3M2ViNGYxMzliMjk4NTJmMDk2MmZmYTFlNmQzMjQ3OTc4OQ==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MTYxZjU0M2JlOTYzY2E5MDI4MDU3Y2QyMmI3ZmRjNjJmY2I4ZGJlMA==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MDFhNWU1YjU2OWU3MTBmZTVhYTNkMmQ1MDk0ZWNmNWU0YTVkYWRkYTU3Mzg0
|
10
|
-
MWFhMTdlYjM0ZTUyZjVjYTc2MTczMGNjNzY1NTczMTk3ODJkMTcyZjMzYzdj
|
11
|
-
ODdlZTM2YmZhZTFjNjhmYzI0N2U3MDA4M2I5ZDc3MmRhODQzOWI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YzM1OTMwNWM5OWMyZjJiZWIxMWEzMjY0NDYxNGIwYWI2MDRhYzQ0MTY5YmQ4
|
14
|
-
Y2RmYWRlZDAwZDBhM2M1NzhlNzcxOTk3NGJhNGM0ZjM3MmJkZTU4ZmMxMjE0
|
15
|
-
NTM1MmJhYzMwYWU1NGM2NDMyOTQxMTE3NTczMTUxOWU3OWRmNWY=
|