-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
384 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require_relative "helper_method/base" | ||
|
||
module IRB | ||
module HelperMethod | ||
@helper_methods = {} | ||
|
||
class << self | ||
attr_reader :helper_methods | ||
|
||
def register(name, helper_class) | ||
@helper_methods[name] = helper_class | ||
end | ||
|
||
def all_helper_methods_info | ||
@helper_methods.map do |name, helper_class| | ||
{ display_name: name, description: helper_class.description, category: helper_class.category } | ||
end | ||
end | ||
end | ||
|
||
# Default helper_methods | ||
require_relative "helper_method/measure" | ||
register(:measure, HelperMethod::Measure) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module IRB | ||
module HelperMethod | ||
class Base | ||
class << self | ||
def category(category = nil) | ||
@category = category if category | ||
@category | ||
end | ||
|
||
def description(description = nil) | ||
@description = description if description | ||
@description | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.