You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/active_method`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
-
TODO: Delete this and the text above, and describe your gem
3
+
Refactor your obscure method to a method object with `ActiveMethod`
6
4
7
5
## Installation
8
6
@@ -16,22 +14,62 @@ If bundler is not being used to manage dependencies, install the gem by executin
16
14
17
15
## Usage
18
16
19
-
TODO: Write usage instructions here
17
+
```ruby
18
+
classExampleMethod < ActiveMethod::Base
19
+
argument :a
20
+
argument :b, default:2
21
+
keyword_argument :c
22
+
keyword_argument :d, default:4
23
+
24
+
defcall
25
+
puts"a: #{a}"
26
+
puts"b: #{b}"
27
+
puts"c: #{c}"
28
+
puts"d: #{d}"
29
+
end
30
+
end
31
+
32
+
ExampleMethod.call(1)
33
+
# => a: 1
34
+
# => b: 2
35
+
# => c: nil
36
+
# => d: 4
37
+
38
+
ExampleMethod.call(1, 3)
39
+
# => a: 1
40
+
# => b: 3
41
+
# => c: nil
42
+
# => d: 4
43
+
44
+
ExampleMethod.call(1, 3, c:6)
45
+
# => a: 1
46
+
# => b: 3
47
+
# => c: 6
48
+
# => d: 4
49
+
50
+
ExampleMethod.call(1, 3, c:4, d:5)
51
+
# => a: 1
52
+
# => b: 3
53
+
# => c: 4
54
+
# => d: 5
55
+
```
20
56
21
57
## Development
22
58
23
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
-
25
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
59
+
```bash
60
+
bundle install
61
+
meval rake # Run test
62
+
meval -a rake # Run tests against all Ruby versions and Rails versions
63
+
```
26
64
27
65
## Contributing
28
66
29
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/active_method. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/active_method/blob/master/CODE_OF_CONDUCT.md).
67
+
Bug reports and pull requests are welcome on GitHub at https://github.com/hoppergee/active_method. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/hoppergee/active_method/blob/master/CODE_OF_CONDUCT.md).
30
68
31
69
## License
32
70
33
71
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
34
72
35
73
## Code of Conduct
36
74
37
-
Everyone interacting in the ActiveMethod project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/active_method/blob/master/CODE_OF_CONDUCT.md).
75
+
Everyone interacting in the ActiveMethod project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/hoppergee/active_method/blob/master/CODE_OF_CONDUCT.md).
0 commit comments