File tree Expand file tree Collapse file tree 2 files changed +28
-25
lines changed
Expand file tree Collapse file tree 2 files changed +28
-25
lines changed Original file line number Diff line number Diff line change @@ -59,26 +59,29 @@ github:
5959` ` `
6060
61611) You can now use the following API to get GitHub information about that team :
62- ` ` ` ruby
63- team = CodeTeams.find('My Team')
64- members = team.github.members
65- github_name = team.github.team
66- ` ` `
6762
68- * Or if your accessor method name differs from your plugin's class name:
63+ ` ` ` ruby
64+ team = CodeTeams.find('My Team')
65+ members = team.github.members
66+ github_name = team.github.team
67+ ` ` `
68+
69+ Alternatively, you can assign an accessor method name that differs from the plugin's class name :
6970
70- ` ` ` ruby
71- class MyPlugin < CodeTeams::Plugin
72- data_accessor_name :other_name
71+ ` ` ` ruby
72+ class MyPlugin < CodeTeams::Plugin
73+ data_accessor_name :other_name
7374
74- def other_name
75- # ...
76- end
77- end
75+ def other_name
76+ # ...
77+ end
78+ end
7879
7980 # You can then use:
8081 team.other_name
8182 # similarly to the Github example above
83+ # You can then access data in the following manner:
84+ team.other_name.attribute_name
8285 ` ` `
8386
8487 However, to avoid confusion, it's recommended to use the naming convention
Original file line number Diff line number Diff line change 1- module CodeTeams
2- class Utils
3- def self . underscore ( string )
4- string . gsub ( '::' , '/' )
5- . gsub ( /([A-Z]+)([A-Z][a-z])/ , '\1_\2' )
6- . gsub ( /([a-z\d ])([A-Z])/ , '\1_\2' )
7- . tr ( '-' , '_' )
8- . downcase
9- end
1+ module CodeTeams ::Utils
2+ extend self
103
11- def self . demodulize ( string )
12- string . split ( '::' ) . last
13- end
4+ def underscore ( string )
5+ string . gsub ( '::' , '/' )
6+ . gsub ( /([A-Z]+)([A-Z][a-z])/ , '\1_\2' )
7+ . gsub ( /([a-z\d ])([A-Z])/ , '\1_\2' )
8+ . tr ( '-' , '_' )
9+ . downcase
10+ end
11+
12+ def demodulize ( string )
13+ string . split ( '::' ) . last
1414 end
1515end
You can’t perform that action at this time.
0 commit comments