Skip to content

Commit 862ee6c

Browse files
committed
Update README for class_method
1 parent 85d8dce commit 862ee6c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,27 @@ Say.hi('John')
108108
# => "Hi, John"
109109
```
110110

111+
### Work as a class method
112+
113+
```ruby
114+
class BuildARobot < ActiveMethod::Base
115+
argument :name
116+
117+
def call
118+
"#{robot_factory} build a robot called #{name}"
119+
end
120+
end
121+
122+
class RobotFactory
123+
include ActiveMethod
124+
125+
active_method :build_a_robot, class_method: true
126+
end
127+
128+
RobotFactory.build_a_robot
129+
# => "RobotFactory build a robot called B-2"
130+
```
131+
111132
## Development
112133

113134
```bash

0 commit comments

Comments
 (0)