Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Commit e552cdc

Browse files
committed
add helpers to fetchers
1 parent 9556ca7 commit e552cdc

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/github-api-client/fetchers.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,19 @@ def parse(data)
55
JSON.parse(data, symbolize_names: true)
66
end
77
end
8+
9+
module Helpers
10+
class << self
11+
def const_at(sym, scope)
12+
throw ArgumentError, "first parameter must be a symbol" unless sym.is_a? Symbol
13+
throw ArgumentError, "scope must be a module" unless scope.is_a? Module
14+
return scope.const_get(sym)
15+
end
16+
17+
def const_name(object)
18+
return object.class.name.split('::').last.to_sym
19+
end
20+
end
21+
end
822
end
923
end

0 commit comments

Comments
 (0)