id
int32
0
24.9k
repo
stringlengths
5
58
path
stringlengths
9
168
func_name
stringlengths
9
130
original_string
stringlengths
66
10.5k
language
stringclasses
1 value
code
stringlengths
66
10.5k
code_tokens
list
docstring
stringlengths
8
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
94
266
2,800
propublica/table-setter
lib/table_setter/table.rb
TableSetter.Table.web_modification_time
def web_modification_time(local_url) resp = nil Net::HTTP.start(local_url.host, 80) do |http| resp = http.head(local_url.path) end resp['Last-Modified'].nil? ? Time.at(0) : Time.parse(resp['Last-Modified']) end
ruby
def web_modification_time(local_url) resp = nil Net::HTTP.start(local_url.host, 80) do |http| resp = http.head(local_url.path) end resp['Last-Modified'].nil? ? Time.at(0) : Time.parse(resp['Last-Modified']) end
[ "def", "web_modification_time", "(", "local_url", ")", "resp", "=", "nil", "Net", "::", "HTTP", ".", "start", "(", "local_url", ".", "host", ",", "80", ")", "do", "|", "http", "|", "resp", "=", "http", ".", "head", "(", "local_url", ".", "path", ")",...
Returns the last-modified time from the remote server. Assumes the remote server knows how to do this. Returns the epoch if the remote is dense.
[ "Returns", "the", "last", "-", "modified", "time", "from", "the", "remote", "server", ".", "Assumes", "the", "remote", "server", "knows", "how", "to", "do", "this", ".", "Returns", "the", "epoch", "if", "the", "remote", "is", "dense", "." ]
11e14dc3359be7cb78400e8a70e0bb0a199daf72
https://github.com/propublica/table-setter/blob/11e14dc3359be7cb78400e8a70e0bb0a199daf72/lib/table_setter/table.rb#L135-L141
2,801
propublica/table-setter
lib/table_setter/table.rb
TableSetter.Table.modification_time
def modification_time(path) is_uri = URI.parse(path) if !is_uri.host.nil? return web_modification_time is_uri end File.new(path).mtime end
ruby
def modification_time(path) is_uri = URI.parse(path) if !is_uri.host.nil? return web_modification_time is_uri end File.new(path).mtime end
[ "def", "modification_time", "(", "path", ")", "is_uri", "=", "URI", ".", "parse", "(", "path", ")", "if", "!", "is_uri", ".", "host", ".", "nil?", "return", "web_modification_time", "is_uri", "end", "File", ".", "new", "(", "path", ")", ".", "mtime", "...
Dispatches to web_modification_time if we're dealing with a url, otherwise just stats the local file.
[ "Dispatches", "to", "web_modification_time", "if", "we", "re", "dealing", "with", "a", "url", "otherwise", "just", "stats", "the", "local", "file", "." ]
11e14dc3359be7cb78400e8a70e0bb0a199daf72
https://github.com/propublica/table-setter/blob/11e14dc3359be7cb78400e8a70e0bb0a199daf72/lib/table_setter/table.rb#L145-L151
2,802
m247/epp-client
lib/epp-client/request.rb
EPP.Request.to_xml
def to_xml doc = XML::Document.new('1.0') doc.root = XML::Node.new('epp') root = doc.root epp_ns = XML::Namespace.new(root, nil, 'urn:ietf:params:xml:ns:epp-1.0') root.namespaces.namespace = epp_ns xsi_ns = XML::Namespace.new(root, 'xsi', 'http://www.w3.org/2001/XMLSch...
ruby
def to_xml doc = XML::Document.new('1.0') doc.root = XML::Node.new('epp') root = doc.root epp_ns = XML::Namespace.new(root, nil, 'urn:ietf:params:xml:ns:epp-1.0') root.namespaces.namespace = epp_ns xsi_ns = XML::Namespace.new(root, 'xsi', 'http://www.w3.org/2001/XMLSch...
[ "def", "to_xml", "doc", "=", "XML", "::", "Document", ".", "new", "(", "'1.0'", ")", "doc", ".", "root", "=", "XML", "::", "Node", ".", "new", "(", "'epp'", ")", "root", "=", "doc", ".", "root", "epp_ns", "=", "XML", "::", "Namespace", ".", "new"...
Receiver in XML form @return [XML::Document] XML of the receiver
[ "Receiver", "in", "XML", "form" ]
72227e57d248f215d842e3dd37e72432d2a79270
https://github.com/m247/epp-client/blob/72227e57d248f215d842e3dd37e72432d2a79270/lib/epp-client/request.rb#L19-L37
2,803
m247/epp-client
lib/epp-client/response.rb
EPP.Response.extension
def extension @extension ||= begin list = @xml.find('/e:epp/e:response/e:extension/node()').reject { |n| n.empty? } list.size > 1 ? list : list[0] end end
ruby
def extension @extension ||= begin list = @xml.find('/e:epp/e:response/e:extension/node()').reject { |n| n.empty? } list.size > 1 ? list : list[0] end end
[ "def", "extension", "@extension", "||=", "begin", "list", "=", "@xml", ".", "find", "(", "'/e:epp/e:response/e:extension/node()'", ")", ".", "reject", "{", "|", "n", "|", "n", ".", "empty?", "}", "list", ".", "size", ">", "1", "?", "list", ":", "list", ...
Response extension block @return [XML::Node, Array<XML::Node>] extension
[ "Response", "extension", "block" ]
72227e57d248f215d842e3dd37e72432d2a79270
https://github.com/m247/epp-client/blob/72227e57d248f215d842e3dd37e72432d2a79270/lib/epp-client/response.rb#L68-L73
2,804
imathis/jekyll-markdown-block
lib/jekyll-markdown-block.rb
Jekyll.MarkdownBlock.render
def render(context) site = context.registers[:site] converter = site.getConverterImpl(::Jekyll::Converters::Markdown) converter.convert(render_block(context)) end
ruby
def render(context) site = context.registers[:site] converter = site.getConverterImpl(::Jekyll::Converters::Markdown) converter.convert(render_block(context)) end
[ "def", "render", "(", "context", ")", "site", "=", "context", ".", "registers", "[", ":site", "]", "converter", "=", "site", ".", "getConverterImpl", "(", "::", "Jekyll", "::", "Converters", "::", "Markdown", ")", "converter", ".", "convert", "(", "render_...
Uses the default Jekyll markdown parser to parse the contents of this block
[ "Uses", "the", "default", "Jekyll", "markdown", "parser", "to", "parse", "the", "contents", "of", "this", "block" ]
6f1a9fd20d684a1f0bcf87d634782f5dd8cc8670
https://github.com/imathis/jekyll-markdown-block/blob/6f1a9fd20d684a1f0bcf87d634782f5dd8cc8670/lib/jekyll-markdown-block.rb#L12-L16
2,805
mat813/rb-kqueue
lib/rb-kqueue/queue.rb
KQueue.Queue.watch_socket_for_read
def watch_socket_for_read(fd, low_water = nil, &callback) Watcher::SocketReadWrite.new(self, fd, :read, low_water, callback) end
ruby
def watch_socket_for_read(fd, low_water = nil, &callback) Watcher::SocketReadWrite.new(self, fd, :read, low_water, callback) end
[ "def", "watch_socket_for_read", "(", "fd", ",", "low_water", "=", "nil", ",", "&", "callback", ")", "Watcher", "::", "SocketReadWrite", ".", "new", "(", "self", ",", "fd", ",", ":read", ",", "low_water", ",", "callback", ")", "end" ]
Watches a socket and produces an event when there's data available to read. Sockets which have previously had `Socket#listen` called fire events when there is an incoming connection pending. In this case, {Event#data} contains the size of the listen backlog. Other sockets return when there is data to be read, su...
[ "Watches", "a", "socket", "and", "produces", "an", "event", "when", "there", "s", "data", "available", "to", "read", "." ]
f11c1a8552812bc0b635ef9751d6dc61d4beaa67
https://github.com/mat813/rb-kqueue/blob/f11c1a8552812bc0b635ef9751d6dc61d4beaa67/lib/rb-kqueue/queue.rb#L123-L125
2,806
mat813/rb-kqueue
lib/rb-kqueue/queue.rb
KQueue.Queue.watch_file
def watch_file(path, *flags, &callback) Watcher::File.new(self, path, flags, callback) end
ruby
def watch_file(path, *flags, &callback) Watcher::File.new(self, path, flags, callback) end
[ "def", "watch_file", "(", "path", ",", "*", "flags", ",", "&", "callback", ")", "Watcher", "::", "File", ".", "new", "(", "self", ",", "path", ",", "flags", ",", "callback", ")", "end" ]
Watches a file or directory for changes. The `flags` parameter specifies which changes will fire events. The {Event#flags} field contains the changes that caused the event to be fired. {Event#data} and {Event#eof?} are unused. Note that this only watches a single file. If the file is a direcotry, it will only ...
[ "Watches", "a", "file", "or", "directory", "for", "changes", ".", "The", "flags", "parameter", "specifies", "which", "changes", "will", "fire", "events", "." ]
f11c1a8552812bc0b635ef9751d6dc61d4beaa67
https://github.com/mat813/rb-kqueue/blob/f11c1a8552812bc0b635ef9751d6dc61d4beaa67/lib/rb-kqueue/queue.rb#L226-L228
2,807
mat813/rb-kqueue
lib/rb-kqueue/queue.rb
KQueue.Queue.watch_process
def watch_process(pid, *flags, &callback) Watcher::Process.new(self, pid, flags, callback) end
ruby
def watch_process(pid, *flags, &callback) Watcher::Process.new(self, pid, flags, callback) end
[ "def", "watch_process", "(", "pid", ",", "*", "flags", ",", "&", "callback", ")", "Watcher", "::", "Process", ".", "new", "(", "self", ",", "pid", ",", "flags", ",", "callback", ")", "end" ]
Watches a process for changes. The `flags` parameter specifies which changes will fire events. The {Event#flags} field contains the changes that caused the event to be fired. {Event#data} and {Event#eof?} are unused. ## Flags `:exit` : The process has exited. `:fork` : The process has created a child proce...
[ "Watches", "a", "process", "for", "changes", ".", "The", "flags", "parameter", "specifies", "which", "changes", "will", "fire", "events", "." ]
f11c1a8552812bc0b635ef9751d6dc61d4beaa67
https://github.com/mat813/rb-kqueue/blob/f11c1a8552812bc0b635ef9751d6dc61d4beaa67/lib/rb-kqueue/queue.rb#L271-L273
2,808
dagrz/nba_stats
lib/nba_stats/stats/common_team_roster.rb
NbaStats.CommonTeamRoster.common_team_roster
def common_team_roster( team_id, season, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::CommonTeamRoster.new( get(COMMON_TEAM_ROSTER_PATH, { :Season => season, :LeagueID => league_id, :TeamID => team_id ...
ruby
def common_team_roster( team_id, season, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::CommonTeamRoster.new( get(COMMON_TEAM_ROSTER_PATH, { :Season => season, :LeagueID => league_id, :TeamID => team_id ...
[ "def", "common_team_roster", "(", "team_id", ",", "season", ",", "league_id", "=", "NbaStats", "::", "Constants", "::", "LEAGUE_ID_NBA", ")", "NbaStats", "::", "Resources", "::", "CommonTeamRoster", ".", "new", "(", "get", "(", "COMMON_TEAM_ROSTER_PATH", ",", "{...
Calls the commonteamroster API and returns a CommonTeamRoster resource. @param team_id [Integer] @param season [String] @param league_id [String] @return [NbaStats::Resources::CommonTeamRoster]
[ "Calls", "the", "commonteamroster", "API", "and", "returns", "a", "CommonTeamRoster", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/common_team_roster.rb#L17-L29
2,809
dcuddeback/rspec-tag_matchers
lib/rspec/tag_matchers/has_input.rb
RSpec::TagMatchers.HasInput.build_name
def build_name(*args) args.extend(DeepFlattening) args = args.deep_flatten name = args.shift.to_s name + args.map {|piece| "[#{piece}]"}.join end
ruby
def build_name(*args) args.extend(DeepFlattening) args = args.deep_flatten name = args.shift.to_s name + args.map {|piece| "[#{piece}]"}.join end
[ "def", "build_name", "(", "*", "args", ")", "args", ".", "extend", "(", "DeepFlattening", ")", "args", "=", "args", ".", "deep_flatten", "name", "=", "args", ".", "shift", ".", "to_s", "name", "+", "args", ".", "map", "{", "|", "piece", "|", "\"[#{pi...
Converts an array or hash of names to a name for an input form. @example build_name(:foo => :bar) # => "foo[bar]" build_name(:foo, :bar) # => "foo[bar]" build_name(:foo => {:bar => :baz}) # => "foo[bar][baz]" build_name(:foo, :bar => :baz) # => "foo[bar][baz]" @param [Array...
[ "Converts", "an", "array", "or", "hash", "of", "names", "to", "a", "name", "for", "an", "input", "form", "." ]
6396a833d99ea669699afb1b3dfc62c4512c8882
https://github.com/dcuddeback/rspec-tag_matchers/blob/6396a833d99ea669699afb1b3dfc62c4512c8882/lib/rspec/tag_matchers/has_input.rb#L119-L124
2,810
dagrz/nba_stats
lib/nba_stats/stats/box_score_advanced.rb
NbaStats.BoxScoreAdvanced.box_score_advanced
def box_score_advanced( game_id, range_type=0, start_period=0, end_period=0, start_range=0, end_range=0 ) NbaStats::Resources::BoxScoreAdvanced.new( get(BOX_SCORE_ADVANCED_PATH, { :GameID => game_id, :RangeType => range_type...
ruby
def box_score_advanced( game_id, range_type=0, start_period=0, end_period=0, start_range=0, end_range=0 ) NbaStats::Resources::BoxScoreAdvanced.new( get(BOX_SCORE_ADVANCED_PATH, { :GameID => game_id, :RangeType => range_type...
[ "def", "box_score_advanced", "(", "game_id", ",", "range_type", "=", "0", ",", "start_period", "=", "0", ",", "end_period", "=", "0", ",", "start_range", "=", "0", ",", "end_range", "=", "0", ")", "NbaStats", "::", "Resources", "::", "BoxScoreAdvanced", "....
Calls the boxscoreadvanced API and returns a BoxScoreAdvanced resource. @param game_id [String] @param range_type [Integer] @param start_period [Integer] @param end_period [Integer] @param start_range [Integer] @param end_range [xxxxxxxxxx] @return [NbaStats::Resources::BoxScoreAdvanced]
[ "Calls", "the", "boxscoreadvanced", "API", "and", "returns", "a", "BoxScoreAdvanced", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/box_score_advanced.rb#L19-L37
2,811
dagrz/nba_stats
lib/nba_stats/stats/common_all_players.rb
NbaStats.CommonAllPlayers.common_all_players
def common_all_players( season, is_only_current_season=0, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::CommonAllPlayers.new( get(COMMON_ALL_PLAYERS_PATH, { :LeagueID => league_id, :Season => season, :IsOnlyCurre...
ruby
def common_all_players( season, is_only_current_season=0, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::CommonAllPlayers.new( get(COMMON_ALL_PLAYERS_PATH, { :LeagueID => league_id, :Season => season, :IsOnlyCurre...
[ "def", "common_all_players", "(", "season", ",", "is_only_current_season", "=", "0", ",", "league_id", "=", "NbaStats", "::", "Constants", "::", "LEAGUE_ID_NBA", ")", "NbaStats", "::", "Resources", "::", "CommonAllPlayers", ".", "new", "(", "get", "(", "COMMON_A...
Calls the commonallplayers API and returns a CommonAllPlayers resource. @param season [String] @param is_only_current_season [Integer] @param league_id [String] @return [NbaStats::Resources::CommonAllPlayers]
[ "Calls", "the", "commonallplayers", "API", "and", "returns", "a", "CommonAllPlayers", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/common_all_players.rb#L17-L29
2,812
dagrz/nba_stats
lib/nba_stats/stats/team_info_common.rb
NbaStats.TeamInfoCommon.team_info_common
def team_info_common( team_id, season, season_type=NbaStats::Constants::SEASON_TYPE_REGULAR, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::TeamInfoCommon.new( get(TEAM_INFO_COMMON_PATH, { :Season => season, :SeasonType...
ruby
def team_info_common( team_id, season, season_type=NbaStats::Constants::SEASON_TYPE_REGULAR, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::TeamInfoCommon.new( get(TEAM_INFO_COMMON_PATH, { :Season => season, :SeasonType...
[ "def", "team_info_common", "(", "team_id", ",", "season", ",", "season_type", "=", "NbaStats", "::", "Constants", "::", "SEASON_TYPE_REGULAR", ",", "league_id", "=", "NbaStats", "::", "Constants", "::", "LEAGUE_ID_NBA", ")", "NbaStats", "::", "Resources", "::", ...
Calls the teaminfocommon API and returns a TeamInfoCommon resource. @param team_id [Integer] @param season [String] @param season_type [String] @param league_id [String] @return [NbaStats::Resources::TeamInfoCommon]
[ "Calls", "the", "teaminfocommon", "API", "and", "returns", "a", "TeamInfoCommon", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/team_info_common.rb#L18-L32
2,813
dagrz/nba_stats
lib/nba_stats/stats/team_year_by_year_stats.rb
NbaStats.TeamYearByYearStats.team_year_by_year_stats
def team_year_by_year_stats( team_id, season, per_mode=NbaStats::Constants::PER_MODE_TOTALS, season_type=NbaStats::Constants::SEASON_TYPE_REGULAR, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::TeamYearByYearStats.new( get(TEAM_YEAR_BY_YEA...
ruby
def team_year_by_year_stats( team_id, season, per_mode=NbaStats::Constants::PER_MODE_TOTALS, season_type=NbaStats::Constants::SEASON_TYPE_REGULAR, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::TeamYearByYearStats.new( get(TEAM_YEAR_BY_YEA...
[ "def", "team_year_by_year_stats", "(", "team_id", ",", "season", ",", "per_mode", "=", "NbaStats", "::", "Constants", "::", "PER_MODE_TOTALS", ",", "season_type", "=", "NbaStats", "::", "Constants", "::", "SEASON_TYPE_REGULAR", ",", "league_id", "=", "NbaStats", "...
Calls the teamyearbyyearstats API and returns a TeamYearByYearStats resource. @param team_id [Integer] @param season [String] @param per_mode [String] @param season_type [String] @param league_id [String] @return [NbaStats::Resources::TeamYearByYearStats]
[ "Calls", "the", "teamyearbyyearstats", "API", "and", "returns", "a", "TeamYearByYearStats", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/team_year_by_year_stats.rb#L18-L34
2,814
dagrz/nba_stats
lib/nba_stats/stats/box_score_usage.rb
NbaStats.BoxScoreUsage.box_score_usage
def box_score_usage( game_id, range_type=0, start_period=0, end_period=0, start_range=0, end_range=0 ) NbaStats::Resources::BoxScoreUsage.new( get(BOX_SCORE_USAGE_PATH, { :GameID => game_id, :RangeType => range_type, ...
ruby
def box_score_usage( game_id, range_type=0, start_period=0, end_period=0, start_range=0, end_range=0 ) NbaStats::Resources::BoxScoreUsage.new( get(BOX_SCORE_USAGE_PATH, { :GameID => game_id, :RangeType => range_type, ...
[ "def", "box_score_usage", "(", "game_id", ",", "range_type", "=", "0", ",", "start_period", "=", "0", ",", "end_period", "=", "0", ",", "start_range", "=", "0", ",", "end_range", "=", "0", ")", "NbaStats", "::", "Resources", "::", "BoxScoreUsage", ".", "...
Calls the boxscoreusage API and returns a BoxScoreUsage resource. @param game_id [String] @param range_type [Integer] @param start_period [Integer] @param end_period [Integer] @param start_range [Integer] @param end_range [Integer] @return [NbaStats::Resources::BoxScoreUsage]
[ "Calls", "the", "boxscoreusage", "API", "and", "returns", "a", "BoxScoreUsage", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/box_score_usage.rb#L19-L37
2,815
dagrz/nba_stats
lib/nba_stats/stats/draft_combine_player_anthro.rb
NbaStats.DraftCombinePlayerAnthro.draft_combine_player_anthro
def draft_combine_player_anthro( season_year, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::DraftCombinePlayerAnthro.new( get(DRAFT_COMBINE_PLAYER_ANTHRO_PATH, { :LeagueID => league_id, :SeasonYear => season_year }) ) ...
ruby
def draft_combine_player_anthro( season_year, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::DraftCombinePlayerAnthro.new( get(DRAFT_COMBINE_PLAYER_ANTHRO_PATH, { :LeagueID => league_id, :SeasonYear => season_year }) ) ...
[ "def", "draft_combine_player_anthro", "(", "season_year", ",", "league_id", "=", "NbaStats", "::", "Constants", "::", "LEAGUE_ID_NBA", ")", "NbaStats", "::", "Resources", "::", "DraftCombinePlayerAnthro", ".", "new", "(", "get", "(", "DRAFT_COMBINE_PLAYER_ANTHRO_PATH", ...
Calls the draftcombineplayeranthro API and returns a DraftCombinePlayerAnthro resource. @param season_year [String] @param league_id [String] @return [NbaStats::Resources::DraftCombinePlayerAnthro]
[ "Calls", "the", "draftcombineplayeranthro", "API", "and", "returns", "a", "DraftCombinePlayerAnthro", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/draft_combine_player_anthro.rb#L15-L25
2,816
codez/wagons
lib/wagons/installer.rb
Wagons.Installer.available
def available return @available if defined?(@available) # only keep most recent version in @available @available = [] load_available_specs.each do |spec| if prev = @available.find { |w| w.name == spec.name } if prev.version < spec.version @available.delete(prev) ...
ruby
def available return @available if defined?(@available) # only keep most recent version in @available @available = [] load_available_specs.each do |spec| if prev = @available.find { |w| w.name == spec.name } if prev.version < spec.version @available.delete(prev) ...
[ "def", "available", "return", "@available", "if", "defined?", "(", "@available", ")", "# only keep most recent version in @available", "@available", "=", "[", "]", "load_available_specs", ".", "each", "do", "|", "spec", "|", "if", "prev", "=", "@available", ".", "...
Most recent gem specifications of all wagons available in GEM_HOME.
[ "Most", "recent", "gem", "specifications", "of", "all", "wagons", "available", "in", "GEM_HOME", "." ]
91a6b687e08ceb8c3e054dd6ec36694d4babcd50
https://github.com/codez/wagons/blob/91a6b687e08ceb8c3e054dd6ec36694d4babcd50/lib/wagons/installer.rb#L20-L36
2,817
codez/wagons
lib/wagons/installer.rb
Wagons.Installer.wagonfile_update
def wagonfile_update(specs) wagonfile_edit(specs) do |spec, content| declaration = "gem '#{spec.name}'" declaration += ", '#{spec.version}'" if include_version_in_wagonfile unless content.sub!(gem_declaration_regexp(spec.name), declaration) content += "\n#{declaration}" e...
ruby
def wagonfile_update(specs) wagonfile_edit(specs) do |spec, content| declaration = "gem '#{spec.name}'" declaration += ", '#{spec.version}'" if include_version_in_wagonfile unless content.sub!(gem_declaration_regexp(spec.name), declaration) content += "\n#{declaration}" e...
[ "def", "wagonfile_update", "(", "specs", ")", "wagonfile_edit", "(", "specs", ")", "do", "|", "spec", ",", "content", "|", "declaration", "=", "\"gem '#{spec.name}'\"", "declaration", "+=", "\", '#{spec.version}'\"", "if", "include_version_in_wagonfile", "unless", "co...
Update the Wagonfile with the given gem specifications.
[ "Update", "the", "Wagonfile", "with", "the", "given", "gem", "specifications", "." ]
91a6b687e08ceb8c3e054dd6ec36694d4babcd50
https://github.com/codez/wagons/blob/91a6b687e08ceb8c3e054dd6ec36694d4babcd50/lib/wagons/installer.rb#L95-L104
2,818
codez/wagons
lib/wagons/installer.rb
Wagons.Installer.wagonfile_remove
def wagonfile_remove(specs) wagonfile_edit(specs) do |spec, content| content.sub(gem_declaration_regexp(spec.name), '') end end
ruby
def wagonfile_remove(specs) wagonfile_edit(specs) do |spec, content| content.sub(gem_declaration_regexp(spec.name), '') end end
[ "def", "wagonfile_remove", "(", "specs", ")", "wagonfile_edit", "(", "specs", ")", "do", "|", "spec", ",", "content", "|", "content", ".", "sub", "(", "gem_declaration_regexp", "(", "spec", ".", "name", ")", ",", "''", ")", "end", "end" ]
Remove the given gem specifications from the Wagonfile.
[ "Remove", "the", "given", "gem", "specifications", "from", "the", "Wagonfile", "." ]
91a6b687e08ceb8c3e054dd6ec36694d4babcd50
https://github.com/codez/wagons/blob/91a6b687e08ceb8c3e054dd6ec36694d4babcd50/lib/wagons/installer.rb#L107-L111
2,819
codez/wagons
lib/wagons/installer.rb
Wagons.Installer.check_dependencies
def check_dependencies(specs) missing = check_app_requirement(specs) present = exclude_specs(installed, specs) future = present + specs check_all_dependencies(specs, future, missing) end
ruby
def check_dependencies(specs) missing = check_app_requirement(specs) present = exclude_specs(installed, specs) future = present + specs check_all_dependencies(specs, future, missing) end
[ "def", "check_dependencies", "(", "specs", ")", "missing", "=", "check_app_requirement", "(", "specs", ")", "present", "=", "exclude_specs", "(", "installed", ",", "specs", ")", "future", "=", "present", "+", "specs", "check_all_dependencies", "(", "specs", ",",...
Check if all wagon dependencies of the given gem specifications are met by the installed wagons. Returns nil if everything is fine or a string with error messages.
[ "Check", "if", "all", "wagon", "dependencies", "of", "the", "given", "gem", "specifications", "are", "met", "by", "the", "installed", "wagons", ".", "Returns", "nil", "if", "everything", "is", "fine", "or", "a", "string", "with", "error", "messages", "." ]
91a6b687e08ceb8c3e054dd6ec36694d4babcd50
https://github.com/codez/wagons/blob/91a6b687e08ceb8c3e054dd6ec36694d4babcd50/lib/wagons/installer.rb#L116-L123
2,820
codez/wagons
lib/wagons/installer.rb
Wagons.Installer.check_app_requirement
def check_app_requirement(specs) missing = [] specs.each do |spec| if wagon = wagon_class(spec) unless wagon.app_requirement.satisfied_by?(Wagons.app_version) missing << "#{spec} requires application version #{wagon.app_requirement}" end end end m...
ruby
def check_app_requirement(specs) missing = [] specs.each do |spec| if wagon = wagon_class(spec) unless wagon.app_requirement.satisfied_by?(Wagons.app_version) missing << "#{spec} requires application version #{wagon.app_requirement}" end end end m...
[ "def", "check_app_requirement", "(", "specs", ")", "missing", "=", "[", "]", "specs", ".", "each", "do", "|", "spec", "|", "if", "wagon", "=", "wagon_class", "(", "spec", ")", "unless", "wagon", ".", "app_requirement", ".", "satisfied_by?", "(", "Wagons", ...
Check if the app requirement of the given gem specifications are met by the current app version. Returns nil if everything is fine or a array with error messages.
[ "Check", "if", "the", "app", "requirement", "of", "the", "given", "gem", "specifications", "are", "met", "by", "the", "current", "app", "version", ".", "Returns", "nil", "if", "everything", "is", "fine", "or", "a", "array", "with", "error", "messages", "."...
91a6b687e08ceb8c3e054dd6ec36694d4babcd50
https://github.com/codez/wagons/blob/91a6b687e08ceb8c3e054dd6ec36694d4babcd50/lib/wagons/installer.rb#L128-L139
2,821
codez/wagons
lib/wagons/installer.rb
Wagons.Installer.check_protected
def check_protected(specs) protected = [] specs.each do |spec| msg = Wagons.find(spec.name).protect? protected << msg if msg.is_a?(String) end protected.join("\n").presence end
ruby
def check_protected(specs) protected = [] specs.each do |spec| msg = Wagons.find(spec.name).protect? protected << msg if msg.is_a?(String) end protected.join("\n").presence end
[ "def", "check_protected", "(", "specs", ")", "protected", "=", "[", "]", "specs", ".", "each", "do", "|", "spec", "|", "msg", "=", "Wagons", ".", "find", "(", "spec", ".", "name", ")", ".", "protect?", "protected", "<<", "msg", "if", "msg", ".", "i...
Checks if the wagons for given gem specifications are protected. Returns nil if everything is fine or a string with error messages.
[ "Checks", "if", "the", "wagons", "for", "given", "gem", "specifications", "are", "protected", ".", "Returns", "nil", "if", "everything", "is", "fine", "or", "a", "string", "with", "error", "messages", "." ]
91a6b687e08ceb8c3e054dd6ec36694d4babcd50
https://github.com/codez/wagons/blob/91a6b687e08ceb8c3e054dd6ec36694d4babcd50/lib/wagons/installer.rb#L151-L158
2,822
codez/wagons
lib/wagons/installer.rb
Wagons.Installer.specs_from_names
def specs_from_names(names) names.map do |name| spec = available_spec(name) fail "#{name} was not found" if spec.nil? spec end end
ruby
def specs_from_names(names) names.map do |name| spec = available_spec(name) fail "#{name} was not found" if spec.nil? spec end end
[ "def", "specs_from_names", "(", "names", ")", "names", ".", "map", "do", "|", "name", "|", "spec", "=", "available_spec", "(", "name", ")", "fail", "\"#{name} was not found\"", "if", "spec", ".", "nil?", "spec", "end", "end" ]
List of available gem specifications with the given names. Raises an error if a name cannot be found.
[ "List", "of", "available", "gem", "specifications", "with", "the", "given", "names", ".", "Raises", "an", "error", "if", "a", "name", "cannot", "be", "found", "." ]
91a6b687e08ceb8c3e054dd6ec36694d4babcd50
https://github.com/codez/wagons/blob/91a6b687e08ceb8c3e054dd6ec36694d4babcd50/lib/wagons/installer.rb#L162-L168
2,823
codez/wagons
lib/wagons/installer.rb
Wagons.Installer.exclude_specs
def exclude_specs(full, to_be_excluded) full.clone.delete_if { |s| to_be_excluded.find { |d| s.name == d.name } } end
ruby
def exclude_specs(full, to_be_excluded) full.clone.delete_if { |s| to_be_excluded.find { |d| s.name == d.name } } end
[ "def", "exclude_specs", "(", "full", ",", "to_be_excluded", ")", "full", ".", "clone", ".", "delete_if", "{", "|", "s", "|", "to_be_excluded", ".", "find", "{", "|", "d", "|", "s", ".", "name", "==", "d", ".", "name", "}", "}", "end" ]
Removes all gem specifications with the same name in to_be_excluded from full. Versions are ignored.
[ "Removes", "all", "gem", "specifications", "with", "the", "same", "name", "in", "to_be_excluded", "from", "full", ".", "Versions", "are", "ignored", "." ]
91a6b687e08ceb8c3e054dd6ec36694d4babcd50
https://github.com/codez/wagons/blob/91a6b687e08ceb8c3e054dd6ec36694d4babcd50/lib/wagons/installer.rb#L172-L174
2,824
codez/wagons
lib/wagons/installer.rb
Wagons.Installer.wagon_class
def wagon_class(spec) @wagon_classes ||= {} return @wagon_classes[spec] if @wagon_classes.key?(spec) clazz = nil file = File.join(spec.gem_dir, 'lib', spec.name, 'wagon.rb') if File.exist?(file) require file clazz = "#{spec.name.camelize}::Wagon".constantize else ...
ruby
def wagon_class(spec) @wagon_classes ||= {} return @wagon_classes[spec] if @wagon_classes.key?(spec) clazz = nil file = File.join(spec.gem_dir, 'lib', spec.name, 'wagon.rb') if File.exist?(file) require file clazz = "#{spec.name.camelize}::Wagon".constantize else ...
[ "def", "wagon_class", "(", "spec", ")", "@wagon_classes", "||=", "{", "}", "return", "@wagon_classes", "[", "spec", "]", "if", "@wagon_classes", ".", "key?", "(", "spec", ")", "clazz", "=", "nil", "file", "=", "File", ".", "join", "(", "spec", ".", "ge...
The wagon class of the given spec.
[ "The", "wagon", "class", "of", "the", "given", "spec", "." ]
91a6b687e08ceb8c3e054dd6ec36694d4babcd50
https://github.com/codez/wagons/blob/91a6b687e08ceb8c3e054dd6ec36694d4babcd50/lib/wagons/installer.rb#L182-L195
2,825
dagrz/nba_stats
lib/nba_stats/stats/common_player_info.rb
NbaStats.CommonPlayerInfo.common_player_info
def common_player_info( player_id, season_type=NbaStats::Constants::SEASON_TYPE_REGULAR, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::CommonPlayerInfo.new( get(COMMON_PLAYER_INFO_PATH, { :PlayerID => player_id, :SeasonType =>...
ruby
def common_player_info( player_id, season_type=NbaStats::Constants::SEASON_TYPE_REGULAR, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::CommonPlayerInfo.new( get(COMMON_PLAYER_INFO_PATH, { :PlayerID => player_id, :SeasonType =>...
[ "def", "common_player_info", "(", "player_id", ",", "season_type", "=", "NbaStats", "::", "Constants", "::", "SEASON_TYPE_REGULAR", ",", "league_id", "=", "NbaStats", "::", "Constants", "::", "LEAGUE_ID_NBA", ")", "NbaStats", "::", "Resources", "::", "CommonPlayerIn...
Calls the commonplayerinfo API and returns a CommonPlayerInfo resource. @param player_id [Integer] @param season_type [String] @param league_id [String] @return [NbaStats::Resources::CommonPlayerInfo]
[ "Calls", "the", "commonplayerinfo", "API", "and", "returns", "a", "CommonPlayerInfo", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/common_player_info.rb#L17-L29
2,826
dagrz/nba_stats
lib/nba_stats/stats/franchise_history.rb
NbaStats.FranchiseHistory.franchise_history
def franchise_history( league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::FranchiseHistory.new( get(FRANCHISE_HISTORY_PATH, { :LeagueID => league_id }) ) end
ruby
def franchise_history( league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::FranchiseHistory.new( get(FRANCHISE_HISTORY_PATH, { :LeagueID => league_id }) ) end
[ "def", "franchise_history", "(", "league_id", "=", "NbaStats", "::", "Constants", "::", "LEAGUE_ID_NBA", ")", "NbaStats", "::", "Resources", "::", "FranchiseHistory", ".", "new", "(", "get", "(", "FRANCHISE_HISTORY_PATH", ",", "{", ":LeagueID", "=>", "league_id", ...
Calls the franchisehistory API and returns a FranchiseHistory resource. @param league_id [String] @return [NbaStats::Resources::FranchiseHistory]
[ "Calls", "the", "franchisehistory", "API", "and", "returns", "a", "FranchiseHistory", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/franchise_history.rb#L14-L22
2,827
dagrz/nba_stats
lib/nba_stats/stats/league_dash_lineups.rb
NbaStats.LeagueDashLineups.league_dash_lineups
def league_dash_lineups( season, group_quantity=5, measure_type=NbaStats::Constants::MEASURE_TYPE_BASE, per_mode=NbaStats::Constants::PER_MODE_GAME, plus_minus=NbaStats::Constants::NO, pace_adjust=NbaStats::Constants::NO, rank=NbaStats::Constants::NO, outc...
ruby
def league_dash_lineups( season, group_quantity=5, measure_type=NbaStats::Constants::MEASURE_TYPE_BASE, per_mode=NbaStats::Constants::PER_MODE_GAME, plus_minus=NbaStats::Constants::NO, pace_adjust=NbaStats::Constants::NO, rank=NbaStats::Constants::NO, outc...
[ "def", "league_dash_lineups", "(", "season", ",", "group_quantity", "=", "5", ",", "measure_type", "=", "NbaStats", "::", "Constants", "::", "MEASURE_TYPE_BASE", ",", "per_mode", "=", "NbaStats", "::", "Constants", "::", "PER_MODE_GAME", ",", "plus_minus", "=", ...
Calls the leaguedashlineups API and returns a LeagueDashLineups resource. @param season [String] @param group_quantity [Integer] @param measure_type [String] @param per_mode [String] @param plus_minus [String] @param pace_adjust [String] @param rank [String] @param outcome [String] @param location [String] @...
[ "Calls", "the", "leaguedashlineups", "API", "and", "returns", "a", "LeagueDashLineups", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/league_dash_lineups.rb#L35-L91
2,828
codez/wagons
lib/wagons/extensions/application.rb
Rails.Application.ordered_railties_with_wagons
def ordered_railties_with_wagons @ordered_railties ||= ordered_railties_without_wagons.tap do |ordered| flat = Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new('4.1.6') Wagons.all.each do |w| if flat ordered.push(ordered.delete(w)) else ordere...
ruby
def ordered_railties_with_wagons @ordered_railties ||= ordered_railties_without_wagons.tap do |ordered| flat = Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new('4.1.6') Wagons.all.each do |w| if flat ordered.push(ordered.delete(w)) else ordere...
[ "def", "ordered_railties_with_wagons", "@ordered_railties", "||=", "ordered_railties_without_wagons", ".", "tap", "do", "|", "ordered", "|", "flat", "=", "Gem", "::", "Version", ".", "new", "(", "Rails", "::", "VERSION", "::", "STRING", ")", "<", "Gem", "::", ...
Append wagons at the end of all railties, even after the application.
[ "Append", "wagons", "at", "the", "end", "of", "all", "railties", "even", "after", "the", "application", "." ]
91a6b687e08ceb8c3e054dd6ec36694d4babcd50
https://github.com/codez/wagons/blob/91a6b687e08ceb8c3e054dd6ec36694d4babcd50/lib/wagons/extensions/application.rb#L6-L17
2,829
dagrz/nba_stats
lib/nba_stats/stats/home_page_leaders.rb
NbaStats.HomePageLeaders.home_page_leaders
def home_page_leaders( season, game_scope=NbaStats::Constants::GAME_SCOPE_SEASON, stat_category=NbaStats::Constants::STAT_CATEGORY_POINTS, player_scope=NbaStats::Constants::PLAYER_SCOPE_ALL_PLAYERS, player_or_team=NbaStats::Constants::PLAYER_OR_TEAM_PLAYER, season_type=Nb...
ruby
def home_page_leaders( season, game_scope=NbaStats::Constants::GAME_SCOPE_SEASON, stat_category=NbaStats::Constants::STAT_CATEGORY_POINTS, player_scope=NbaStats::Constants::PLAYER_SCOPE_ALL_PLAYERS, player_or_team=NbaStats::Constants::PLAYER_OR_TEAM_PLAYER, season_type=Nb...
[ "def", "home_page_leaders", "(", "season", ",", "game_scope", "=", "NbaStats", "::", "Constants", "::", "GAME_SCOPE_SEASON", ",", "stat_category", "=", "NbaStats", "::", "Constants", "::", "STAT_CATEGORY_POINTS", ",", "player_scope", "=", "NbaStats", "::", "Constant...
Calls the homepageleaders API and returns a HomePageLeaders resource. @param season [String] @param season_type [String] @param league_id [String] @param game_scope [String] @param stat_category [String] @param player_scope [String] @param player_or_team [String] @return [NbaStats::Resources::HomePageLeaders]
[ "Calls", "the", "homepageleaders", "API", "and", "returns", "a", "HomePageLeaders", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/home_page_leaders.rb#L20-L40
2,830
dagrz/nba_stats
lib/nba_stats/stats/team_game_log.rb
NbaStats.TeamGameLog.team_game_log
def team_game_log( team_id, season, season_type=NbaStats::Constants::SEASON_TYPE_REGULAR, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::TeamGameLog.new( get(TEAM_GAME_LOG_PATH, { :Season => season, :SeasonType => seaso...
ruby
def team_game_log( team_id, season, season_type=NbaStats::Constants::SEASON_TYPE_REGULAR, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::TeamGameLog.new( get(TEAM_GAME_LOG_PATH, { :Season => season, :SeasonType => seaso...
[ "def", "team_game_log", "(", "team_id", ",", "season", ",", "season_type", "=", "NbaStats", "::", "Constants", "::", "SEASON_TYPE_REGULAR", ",", "league_id", "=", "NbaStats", "::", "Constants", "::", "LEAGUE_ID_NBA", ")", "NbaStats", "::", "Resources", "::", "Te...
Calls the teamgamelog API and returns a TeamGameLog resource. @param team_id [Integer] @param season [String] @param season_type [String] @param league_id [String] @return [NbaStats::Resources::TeamGameLog]
[ "Calls", "the", "teamgamelog", "API", "and", "returns", "a", "TeamGameLog", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/team_game_log.rb#L18-L32
2,831
dagrz/nba_stats
lib/nba_stats/stats/box_score_scoring.rb
NbaStats.BoxScoreScoring.box_score_scoring
def box_score_scoring( game_id, range_type=0, start_period=0, end_period=0, start_range=0, end_range=0 ) NbaStats::Resources::BoxScoreScoring.new( get(BOX_SCORE_SCORING_PATH, { :GameID => game_id, :RangeType => range_type, ...
ruby
def box_score_scoring( game_id, range_type=0, start_period=0, end_period=0, start_range=0, end_range=0 ) NbaStats::Resources::BoxScoreScoring.new( get(BOX_SCORE_SCORING_PATH, { :GameID => game_id, :RangeType => range_type, ...
[ "def", "box_score_scoring", "(", "game_id", ",", "range_type", "=", "0", ",", "start_period", "=", "0", ",", "end_period", "=", "0", ",", "start_range", "=", "0", ",", "end_range", "=", "0", ")", "NbaStats", "::", "Resources", "::", "BoxScoreScoring", ".",...
Calls the boxscorescoring API and returns a BoxScoreScoring resource. @param game_id [String] @param range_type [Integer] @param start_period [Integer] @param end_period [Integer] @param start_range [Integer] @param end_range [Integer] @return [NbaStats::Resources::BoxScoreScoring]
[ "Calls", "the", "boxscorescoring", "API", "and", "returns", "a", "BoxScoreScoring", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/box_score_scoring.rb#L19-L37
2,832
dagrz/nba_stats
lib/nba_stats/stats/draft_combine_spot_shooting.rb
NbaStats.DraftCombineSpotShooting.draft_combine_spot_shooting
def draft_combine_spot_shooting( season_year, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::DraftCombineSpotShooting.new( get(DRAFT_COMBINE_SPOT_SHOOTING_PATH, { :LeagueID => league_id, :SeasonYear => season_year }) ) ...
ruby
def draft_combine_spot_shooting( season_year, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::DraftCombineSpotShooting.new( get(DRAFT_COMBINE_SPOT_SHOOTING_PATH, { :LeagueID => league_id, :SeasonYear => season_year }) ) ...
[ "def", "draft_combine_spot_shooting", "(", "season_year", ",", "league_id", "=", "NbaStats", "::", "Constants", "::", "LEAGUE_ID_NBA", ")", "NbaStats", "::", "Resources", "::", "DraftCombineSpotShooting", ".", "new", "(", "get", "(", "DRAFT_COMBINE_SPOT_SHOOTING_PATH", ...
Calls the draftcombinespotshooting API and returns a DraftCombineSpotShooting resource. @param season_year [String] @param league_id [String] @return [NbaStats::Resources::DraftCombineSpotShooting]
[ "Calls", "the", "draftcombinespotshooting", "API", "and", "returns", "a", "DraftCombineSpotShooting", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/draft_combine_spot_shooting.rb#L15-L25
2,833
dagrz/nba_stats
lib/nba_stats/stats/common_team_years.rb
NbaStats.CommonTeamYears.common_team_years
def common_team_years( league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::CommonTeamYears.new( get(COMMON_TEAM_YEARS_PATH, { :LeagueID => league_id }) ) end
ruby
def common_team_years( league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::CommonTeamYears.new( get(COMMON_TEAM_YEARS_PATH, { :LeagueID => league_id }) ) end
[ "def", "common_team_years", "(", "league_id", "=", "NbaStats", "::", "Constants", "::", "LEAGUE_ID_NBA", ")", "NbaStats", "::", "Resources", "::", "CommonTeamYears", ".", "new", "(", "get", "(", "COMMON_TEAM_YEARS_PATH", ",", "{", ":LeagueID", "=>", "league_id", ...
Calls the commonteamyears API and returns a CommonTeamYears resource. @param league_id [String] @return [NbaStats::Resources::CommonTeamYears]
[ "Calls", "the", "commonteamyears", "API", "and", "returns", "a", "CommonTeamYears", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/common_team_years.rb#L14-L22
2,834
forcedotcom/salesforce-deskcom-api
lib/desk_api/client.rb
DeskApi.Client.request
def request(method, path, params = {}, &block) connection.send(method, path, params, &block) rescue Faraday::Error::ClientError => err raise DeskApi::Error::ClientError.new(err) rescue JSON::ParserError => err raise DeskApi::Error::ParserError.new(err) end
ruby
def request(method, path, params = {}, &block) connection.send(method, path, params, &block) rescue Faraday::Error::ClientError => err raise DeskApi::Error::ClientError.new(err) rescue JSON::ParserError => err raise DeskApi::Error::ParserError.new(err) end
[ "def", "request", "(", "method", ",", "path", ",", "params", "=", "{", "}", ",", "&", "block", ")", "connection", ".", "send", "(", "method", ",", "path", ",", "params", ",", "block", ")", "rescue", "Faraday", "::", "Error", "::", "ClientError", "=>"...
Hands off the request to Faraday for further processing @param method [Symbol] the http method to call @param path [String] the url path to the resource @param params [Hash] optional additional url params @yield [Faraday::Response] for further request customizations. @return [Faraday::Response] @raises [DeskApi:...
[ "Hands", "off", "the", "request", "to", "Faraday", "for", "further", "processing" ]
af1080459215d4cb769e785656bcee1d56696f95
https://github.com/forcedotcom/salesforce-deskcom-api/blob/af1080459215d4cb769e785656bcee1d56696f95/lib/desk_api/client.rb#L104-L110
2,835
dagrz/nba_stats
lib/nba_stats/stats/shot_chart_detail.rb
NbaStats.ShotChartDetail.shot_chart_detail
def shot_chart_detail( season, team_id, player_id, game_id=nil, outcome=nil, location=nil, month=0, season_segment=nil, date_from=nil, date_to=nil, opponent_team_id=0, vs_conference=nil, vs_division=nil, posi...
ruby
def shot_chart_detail( season, team_id, player_id, game_id=nil, outcome=nil, location=nil, month=0, season_segment=nil, date_from=nil, date_to=nil, opponent_team_id=0, vs_conference=nil, vs_division=nil, posi...
[ "def", "shot_chart_detail", "(", "season", ",", "team_id", ",", "player_id", ",", "game_id", "=", "nil", ",", "outcome", "=", "nil", ",", "location", "=", "nil", ",", "month", "=", "0", ",", "season_segment", "=", "nil", ",", "date_from", "=", "nil", "...
Calls the shotchartdetail API and returns a ShotChartDetail resource. @param season [String] @param team_id [Integer] @param player_id [Integer] @param game_id [String] @param outcome [String] @param location [String] @param month [Integer] @param season_segment [String] @param date_from [Date] @param date_t...
[ "Calls", "the", "shotchartdetail", "API", "and", "returns", "a", "ShotChartDetail", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/shot_chart_detail.rb#L35-L91
2,836
forcedotcom/salesforce-deskcom-api
lib/desk_api/configuration.rb
DeskApi.Configuration.middleware
def middleware @middleware ||= proc do |builder| builder.request(:desk_encode_dates) builder.request(:desk_encode_json) builder.request(*authorize_request) builder.request(:desk_retry) builder.response(:desk_parse_dates) builder.response(:desk_follow_redirects) ...
ruby
def middleware @middleware ||= proc do |builder| builder.request(:desk_encode_dates) builder.request(:desk_encode_json) builder.request(*authorize_request) builder.request(:desk_retry) builder.response(:desk_parse_dates) builder.response(:desk_follow_redirects) ...
[ "def", "middleware", "@middleware", "||=", "proc", "do", "|", "builder", "|", "builder", ".", "request", "(", ":desk_encode_dates", ")", "builder", ".", "request", "(", ":desk_encode_json", ")", "builder", ".", "request", "(", "authorize_request", ")", "builder"...
Returns the middleware proc to be used by Faraday @return [Proc]
[ "Returns", "the", "middleware", "proc", "to", "be", "used", "by", "Faraday" ]
af1080459215d4cb769e785656bcee1d56696f95
https://github.com/forcedotcom/salesforce-deskcom-api/blob/af1080459215d4cb769e785656bcee1d56696f95/lib/desk_api/configuration.rb#L109-L124
2,837
forcedotcom/salesforce-deskcom-api
lib/desk_api/configuration.rb
DeskApi.Configuration.reset!
def reset! DeskApi::Configuration.keys.each do |key| send("#{key}=", DeskApi::Default.options[key]) end self end
ruby
def reset! DeskApi::Configuration.keys.each do |key| send("#{key}=", DeskApi::Default.options[key]) end self end
[ "def", "reset!", "DeskApi", "::", "Configuration", ".", "keys", ".", "each", "do", "|", "key", "|", "send", "(", "\"#{key}=\"", ",", "DeskApi", "::", "Default", ".", "options", "[", "key", "]", ")", "end", "self", "end" ]
Resets the client to the default settings. @return [DeskApi::Client]
[ "Resets", "the", "client", "to", "the", "default", "settings", "." ]
af1080459215d4cb769e785656bcee1d56696f95
https://github.com/forcedotcom/salesforce-deskcom-api/blob/af1080459215d4cb769e785656bcee1d56696f95/lib/desk_api/configuration.rb#L140-L145
2,838
forcedotcom/salesforce-deskcom-api
lib/desk_api/configuration.rb
DeskApi.Configuration.validate_credentials!
def validate_credentials! fail( DeskApi::Error::ConfigurationError, 'Invalid credentials: ' \ 'Either username/password or OAuth credentials must be specified.' ) unless credentials? validate_oauth! if oauth.values.all? validate_basic_auth! if basic_auth.values.all? end
ruby
def validate_credentials! fail( DeskApi::Error::ConfigurationError, 'Invalid credentials: ' \ 'Either username/password or OAuth credentials must be specified.' ) unless credentials? validate_oauth! if oauth.values.all? validate_basic_auth! if basic_auth.values.all? end
[ "def", "validate_credentials!", "fail", "(", "DeskApi", "::", "Error", "::", "ConfigurationError", ",", "'Invalid credentials: '", "'Either username/password or OAuth credentials must be specified.'", ")", "unless", "credentials?", "validate_oauth!", "if", "oauth", ".", "values...
Raises an error if credentials are not set or of the wrong type. @raise [DeskApi::Error::ConfigurationError]
[ "Raises", "an", "error", "if", "credentials", "are", "not", "set", "or", "of", "the", "wrong", "type", "." ]
af1080459215d4cb769e785656bcee1d56696f95
https://github.com/forcedotcom/salesforce-deskcom-api/blob/af1080459215d4cb769e785656bcee1d56696f95/lib/desk_api/configuration.rb#L207-L215
2,839
domitry/mikon
lib/mikon/pivot.rb
Mikon.DataFrame.pivot
def pivot(args={}) args = { column: nil, row: nil, value: nil, fill_value: Float::NAN }.merge(args) raise ArgumentError unless [:column, :row, :value].all?{|sym| args[sym].is_a?(Symbol)} column = self[args[:column]].factors index = self[args[:row]].factors...
ruby
def pivot(args={}) args = { column: nil, row: nil, value: nil, fill_value: Float::NAN }.merge(args) raise ArgumentError unless [:column, :row, :value].all?{|sym| args[sym].is_a?(Symbol)} column = self[args[:column]].factors index = self[args[:row]].factors...
[ "def", "pivot", "(", "args", "=", "{", "}", ")", "args", "=", "{", "column", ":", "nil", ",", "row", ":", "nil", ",", "value", ":", "nil", ",", "fill_value", ":", "Float", "::", "NAN", "}", ".", "merge", "(", "args", ")", "raise", "ArgumentError"...
Experimental Implementation. DO NOT USE THIS METHOD
[ "Experimental", "Implementation", ".", "DO", "NOT", "USE", "THIS", "METHOD" ]
69886f5b6767d141e0a5624f0de2f34743909537
https://github.com/domitry/mikon/blob/69886f5b6767d141e0a5624f0de2f34743909537/lib/mikon/pivot.rb#L5-L34
2,840
jasonl/eden
lib/eden/tokenizers/basic_tokenizer.rb
Eden.BasicTokenizer.translate_keyword_tokens
def translate_keyword_tokens( token ) keywords = ["__LINE__", "__ENCODING__", "__FILE__", "BEGIN", "END", "alias", "and", "begin", "break", "case", "class", "def", "defined?", "do", "else", "elsif", "end", "ensure", "false", "for", "if", "in", ...
ruby
def translate_keyword_tokens( token ) keywords = ["__LINE__", "__ENCODING__", "__FILE__", "BEGIN", "END", "alias", "and", "begin", "break", "case", "class", "def", "defined?", "do", "else", "elsif", "end", "ensure", "false", "for", "if", "in", ...
[ "def", "translate_keyword_tokens", "(", "token", ")", "keywords", "=", "[", "\"__LINE__\"", ",", "\"__ENCODING__\"", ",", "\"__FILE__\"", ",", "\"BEGIN\"", ",", "\"END\"", ",", "\"alias\"", ",", "\"and\"", ",", "\"begin\"", ",", "\"break\"", ",", "\"case\"", ","...
Takes an identifier token, and tranforms its type to match Ruby keywords where the identifier is actually a keyword. Reserved words are defined in S.8.5.1 of the Ruby spec.
[ "Takes", "an", "identifier", "token", "and", "tranforms", "its", "type", "to", "match", "Ruby", "keywords", "where", "the", "identifier", "is", "actually", "a", "keyword", ".", "Reserved", "words", "are", "defined", "in", "S", ".", "8", ".", "5", ".", "1...
8a08a4000c63a6b20c07a872cca2dcb0d263baf9
https://github.com/jasonl/eden/blob/8a08a4000c63a6b20c07a872cca2dcb0d263baf9/lib/eden/tokenizers/basic_tokenizer.rb#L140-L165
2,841
dagrz/nba_stats
lib/nba_stats/client.rb
NbaStats.Client.get
def get(path='/', params={}) uri = Addressable::URI.new uri.query_values = params # Build the path with + instead of %20 because nba.com is flaky full_path = "#{path}?#{uri.query.gsub(/%20/,'+')}" request(:get, full_path) end
ruby
def get(path='/', params={}) uri = Addressable::URI.new uri.query_values = params # Build the path with + instead of %20 because nba.com is flaky full_path = "#{path}?#{uri.query.gsub(/%20/,'+')}" request(:get, full_path) end
[ "def", "get", "(", "path", "=", "'/'", ",", "params", "=", "{", "}", ")", "uri", "=", "Addressable", "::", "URI", ".", "new", "uri", ".", "query_values", "=", "params", "# Build the path with + instead of %20 because nba.com is flaky", "full_path", "=", "\"#{pat...
Perform a HTTP GET request @param path [String] @param params [Hash] @return [Hash]
[ "Perform", "a", "HTTP", "GET", "request" ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/client.rb#L103-L109
2,842
dagrz/nba_stats
lib/nba_stats/client.rb
NbaStats.Client.request
def request(method, path) resource[path].send(method.to_sym, request_headers) { |response, request, result, &block| case response.code when 200 response when 400 if response.include? ' is required' raise ArgumentError.new(response) ...
ruby
def request(method, path) resource[path].send(method.to_sym, request_headers) { |response, request, result, &block| case response.code when 200 response when 400 if response.include? ' is required' raise ArgumentError.new(response) ...
[ "def", "request", "(", "method", ",", "path", ")", "resource", "[", "path", "]", ".", "send", "(", "method", ".", "to_sym", ",", "request_headers", ")", "{", "|", "response", ",", "request", ",", "result", ",", "&", "block", "|", "case", "response", ...
Send the HTTP request @param method [String] @param path [String] @return [RestClient::Response]
[ "Send", "the", "HTTP", "request" ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/client.rb#L123-L138
2,843
dagrz/nba_stats
lib/nba_stats/stats/draft_combine_stats.rb
NbaStats.DraftCombineStats.draft_combine_stats
def draft_combine_stats( season_year, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::DraftCombineStats.new( get(DRAFT_COMBINE_STATS_PATH, { :LeagueID => league_id, :SeasonYear => season_year }) ) end
ruby
def draft_combine_stats( season_year, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::DraftCombineStats.new( get(DRAFT_COMBINE_STATS_PATH, { :LeagueID => league_id, :SeasonYear => season_year }) ) end
[ "def", "draft_combine_stats", "(", "season_year", ",", "league_id", "=", "NbaStats", "::", "Constants", "::", "LEAGUE_ID_NBA", ")", "NbaStats", "::", "Resources", "::", "DraftCombineStats", ".", "new", "(", "get", "(", "DRAFT_COMBINE_STATS_PATH", ",", "{", ":Leagu...
Calls the draftcombinestats API and returns a DraftCombineStats resource. @param season_year [String] @param league_id [String] @return [NbaStats::Resources::DraftCombineStats]
[ "Calls", "the", "draftcombinestats", "API", "and", "returns", "a", "DraftCombineStats", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/draft_combine_stats.rb#L15-L25
2,844
dagrz/nba_stats
lib/nba_stats/stats/player_dashboard_by_general_splits.rb
NbaStats.PlayerDashboardByGeneralSplits.player_dashboard_by_general_splits
def player_dashboard_by_general_splits( season, player_id, date_from=nil, date_to=nil, game_segment=nil, last_n_games=0, league_id=NbaStats::Constants::LEAGUE_ID_NBA, location=nil, measure_type=NbaStats::Constants::MEASURE_TYPE_USAGE, month...
ruby
def player_dashboard_by_general_splits( season, player_id, date_from=nil, date_to=nil, game_segment=nil, last_n_games=0, league_id=NbaStats::Constants::LEAGUE_ID_NBA, location=nil, measure_type=NbaStats::Constants::MEASURE_TYPE_USAGE, month...
[ "def", "player_dashboard_by_general_splits", "(", "season", ",", "player_id", ",", "date_from", "=", "nil", ",", "date_to", "=", "nil", ",", "game_segment", "=", "nil", ",", "last_n_games", "=", "0", ",", "league_id", "=", "NbaStats", "::", "Constants", "::", ...
Calls the playerdashboardbygeneralsplits API and returns a PlayerDashboardByGeneralSplits resource. @param season [String] @param player_id [Integer] @param date_from [Date] @param date_to [Date] @param game_segment [String] @param last_n_games [Integer] @param league_id [String] @param location [String] @par...
[ "Calls", "the", "playerdashboardbygeneralsplits", "API", "and", "returns", "a", "PlayerDashboardByGeneralSplits", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/player_dashboard_by_general_splits.rb#L34-L88
2,845
dcuddeback/rspec-tag_matchers
lib/rspec/tag_matchers/helpers/sentence_helper.rb
RSpec::TagMatchers::Helpers.SentenceHelper.make_sentence
def make_sentence(*strings) options = strings.last.is_a?(Hash) ? strings.pop : {} strings = strings.flatten.map(&:to_s).reject(&:empty?) conjunction = options[:conjunction] || "and" case strings.count when 0 "" when 1 strings.first else last ...
ruby
def make_sentence(*strings) options = strings.last.is_a?(Hash) ? strings.pop : {} strings = strings.flatten.map(&:to_s).reject(&:empty?) conjunction = options[:conjunction] || "and" case strings.count when 0 "" when 1 strings.first else last ...
[ "def", "make_sentence", "(", "*", "strings", ")", "options", "=", "strings", ".", "last", ".", "is_a?", "(", "Hash", ")", "?", "strings", ".", "pop", ":", "{", "}", "strings", "=", "strings", ".", "flatten", ".", "map", "(", ":to_s", ")", ".", "rej...
Joins multiple strings into a sentence with punctuation and conjunctions. @example Forming sentences make_sentence("foo") # => "foo" make_sentence("foo", "bar") # => "foo and bar" make_sentence("foo", "bar", "baz") # => "foo, bar, and baz" @example Overriding the conjunction make...
[ "Joins", "multiple", "strings", "into", "a", "sentence", "with", "punctuation", "and", "conjunctions", "." ]
6396a833d99ea669699afb1b3dfc62c4512c8882
https://github.com/dcuddeback/rspec-tag_matchers/blob/6396a833d99ea669699afb1b3dfc62c4512c8882/lib/rspec/tag_matchers/helpers/sentence_helper.rb#L20-L36
2,846
MrEmelianenko/drape
lib/drape/automatic_delegation.rb
Drape.AutomaticDelegation.method_missing
def method_missing(method, *args, &block) return super unless delegatable?(method) self.class.delegate method send(method, *args, &block) end
ruby
def method_missing(method, *args, &block) return super unless delegatable?(method) self.class.delegate method send(method, *args, &block) end
[ "def", "method_missing", "(", "method", ",", "*", "args", ",", "&", "block", ")", "return", "super", "unless", "delegatable?", "(", "method", ")", "self", ".", "class", ".", "delegate", "method", "send", "(", "method", ",", "args", ",", "block", ")", "...
Delegates missing instance methods to the source object.
[ "Delegates", "missing", "instance", "methods", "to", "the", "source", "object", "." ]
cc9e8d55341d3145317d425031f5cb46f9cba552
https://github.com/MrEmelianenko/drape/blob/cc9e8d55341d3145317d425031f5cb46f9cba552/lib/drape/automatic_delegation.rb#L6-L11
2,847
dagrz/nba_stats
lib/nba_stats/stats/box_score_four_factors.rb
NbaStats.BoxScoreFourFactors.box_score_four_factors
def box_score_four_factors( game_id, range_type=0, start_period=0, end_period=0, start_range=0, end_range=0 ) NbaStats::Resources::BoxScoreFourFactors.new( get(BOX_SCORE_FOUR_FACTORS_PATH, { :GameID => game_id, :RangeType =>...
ruby
def box_score_four_factors( game_id, range_type=0, start_period=0, end_period=0, start_range=0, end_range=0 ) NbaStats::Resources::BoxScoreFourFactors.new( get(BOX_SCORE_FOUR_FACTORS_PATH, { :GameID => game_id, :RangeType =>...
[ "def", "box_score_four_factors", "(", "game_id", ",", "range_type", "=", "0", ",", "start_period", "=", "0", ",", "end_period", "=", "0", ",", "start_range", "=", "0", ",", "end_range", "=", "0", ")", "NbaStats", "::", "Resources", "::", "BoxScoreFourFactors...
Calls the boxscorefourfactors API and returns a BoxScoreFourFactors resource. @param game_id [String] @param range_type [Integer] @param start_period [Integer] @param end_period [Integer] @param start_range [Integer] @param end_range [Integer] @return [NbaStats::Resources::BoxScoreFourFactors]
[ "Calls", "the", "boxscorefourfactors", "API", "and", "returns", "a", "BoxScoreFourFactors", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/box_score_four_factors.rb#L19-L37
2,848
dcuddeback/rspec-tag_matchers
lib/rspec/tag_matchers/has_tag.rb
RSpec::TagMatchers.HasTag.matches?
def matches?(rendered) @rendered = rendered matches = Nokogiri::HTML::Document.parse(@rendered.to_s).css(@name).select do |element| matches_attributes?(element) && matches_content?(element) && matches_criteria?(element) end matches_count?(matches) end
ruby
def matches?(rendered) @rendered = rendered matches = Nokogiri::HTML::Document.parse(@rendered.to_s).css(@name).select do |element| matches_attributes?(element) && matches_content?(element) && matches_criteria?(element) end matches_count?(matches) end
[ "def", "matches?", "(", "rendered", ")", "@rendered", "=", "rendered", "matches", "=", "Nokogiri", "::", "HTML", "::", "Document", ".", "parse", "(", "@rendered", ".", "to_s", ")", ".", "css", "(", "@name", ")", ".", "select", "do", "|", "element", "|"...
Answers whether or not the matcher matches any elements within +rendered+. @param [String] rendered A string of HTML or an Object whose +to_s+ method returns HTML. (That includes Nokogiri classes.) @return [Boolean]
[ "Answers", "whether", "or", "not", "the", "matcher", "matches", "any", "elements", "within", "+", "rendered", "+", "." ]
6396a833d99ea669699afb1b3dfc62c4512c8882
https://github.com/dcuddeback/rspec-tag_matchers/blob/6396a833d99ea669699afb1b3dfc62c4512c8882/lib/rspec/tag_matchers/has_tag.rb#L140-L146
2,849
dcuddeback/rspec-tag_matchers
lib/rspec/tag_matchers/has_tag.rb
RSpec::TagMatchers.HasTag.grouped_attributes_description
def grouped_attributes_description(attributes) make_sentence( attributes.sort_by{ |key, value| key.to_s }.map do |key, value| attribute_description(key, value) end ) end
ruby
def grouped_attributes_description(attributes) make_sentence( attributes.sort_by{ |key, value| key.to_s }.map do |key, value| attribute_description(key, value) end ) end
[ "def", "grouped_attributes_description", "(", "attributes", ")", "make_sentence", "(", "attributes", ".", "sort_by", "{", "|", "key", ",", "value", "|", "key", ".", "to_s", "}", ".", "map", "do", "|", "key", ",", "value", "|", "attribute_description", "(", ...
Describes a group of attribute criteria, combining them into a sentence fragment, with punctuation and conjunctions if necessary. @param [Array] attributes A list of <tt>[key, value]</tt> pairs that describe the attribute criteria. @return [String]
[ "Describes", "a", "group", "of", "attribute", "criteria", "combining", "them", "into", "a", "sentence", "fragment", "with", "punctuation", "and", "conjunctions", "if", "necessary", "." ]
6396a833d99ea669699afb1b3dfc62c4512c8882
https://github.com/dcuddeback/rspec-tag_matchers/blob/6396a833d99ea669699afb1b3dfc62c4512c8882/lib/rspec/tag_matchers/has_tag.rb#L358-L364
2,850
dagrz/nba_stats
lib/nba_stats/stats/player_profile.rb
NbaStats.PlayerProfile.player_profile
def player_profile( player_id, season, graph_start_season, graph_end_season, graph_stat=NbaStats::Constants::GRAPH_STAT_POINTS, season_type=NbaStats::Constants::SEASON_TYPE_REGULAR, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::Play...
ruby
def player_profile( player_id, season, graph_start_season, graph_end_season, graph_stat=NbaStats::Constants::GRAPH_STAT_POINTS, season_type=NbaStats::Constants::SEASON_TYPE_REGULAR, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::Play...
[ "def", "player_profile", "(", "player_id", ",", "season", ",", "graph_start_season", ",", "graph_end_season", ",", "graph_stat", "=", "NbaStats", "::", "Constants", "::", "GRAPH_STAT_POINTS", ",", "season_type", "=", "NbaStats", "::", "Constants", "::", "SEASON_TYPE...
Calls the playerprofile API and returns a PlayerProfile resource. @param player_id [Integer] @param season [String] @param graph_start_season [String] @param graph_end_season [String] @param graph_stat [String] @param season_type [String] @param league_id [String] @return [NbaStats::Resources::PlayerProfile]
[ "Calls", "the", "playerprofile", "API", "and", "returns", "a", "PlayerProfile", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/player_profile.rb#L21-L41
2,851
dagrz/nba_stats
lib/nba_stats/stats/player_career_stats.rb
NbaStats.PlayerCareerStats.player_career_stats
def player_career_stats( player_id, per_mode=NbaStats::Constants::PER_MODE_TOTALS, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::PlayerCareerStats.new( get(PLAYER_CAREER_STATS_PATH, { :PlayerID => player_id, :LeagueID => leagu...
ruby
def player_career_stats( player_id, per_mode=NbaStats::Constants::PER_MODE_TOTALS, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::PlayerCareerStats.new( get(PLAYER_CAREER_STATS_PATH, { :PlayerID => player_id, :LeagueID => leagu...
[ "def", "player_career_stats", "(", "player_id", ",", "per_mode", "=", "NbaStats", "::", "Constants", "::", "PER_MODE_TOTALS", ",", "league_id", "=", "NbaStats", "::", "Constants", "::", "LEAGUE_ID_NBA", ")", "NbaStats", "::", "Resources", "::", "PlayerCareerStats", ...
Calls the playercareerstats API and returns a PlayerCareerStats resource. @param player_id [Integer] @param per_mode [String] @param league_id [String] @return [NbaStats::Resources::PlayerCareerStats]
[ "Calls", "the", "playercareerstats", "API", "and", "returns", "a", "PlayerCareerStats", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/player_career_stats.rb#L16-L28
2,852
jasonl/eden
lib/eden/tokenizers/string_tokenizer.rb
Eden.StringTokenizer.tokenize_non_expanded_string
def tokenize_non_expanded_string( start_delimiter ) delimiter_depth = 0 matched_delimiter = is_matched_delimiter?( start_delimiter ) end_delimiter = find_matching_delimiter( start_delimiter ) advance # Pass the opening delimiter until((cchar == end_delimiter && delimiter_depth == 0) || @...
ruby
def tokenize_non_expanded_string( start_delimiter ) delimiter_depth = 0 matched_delimiter = is_matched_delimiter?( start_delimiter ) end_delimiter = find_matching_delimiter( start_delimiter ) advance # Pass the opening delimiter until((cchar == end_delimiter && delimiter_depth == 0) || @...
[ "def", "tokenize_non_expanded_string", "(", "start_delimiter", ")", "delimiter_depth", "=", "0", "matched_delimiter", "=", "is_matched_delimiter?", "(", "start_delimiter", ")", "end_delimiter", "=", "find_matching_delimiter", "(", "start_delimiter", ")", "advance", "# Pass ...
If a block is given, it gets run after the final delimiter is detected. The primary purpose for this is to allow the capture of regex modifiers
[ "If", "a", "block", "is", "given", "it", "gets", "run", "after", "the", "final", "delimiter", "is", "detected", ".", "The", "primary", "purpose", "for", "this", "is", "to", "allow", "the", "capture", "of", "regex", "modifiers" ]
8a08a4000c63a6b20c07a872cca2dcb0d263baf9
https://github.com/jasonl/eden/blob/8a08a4000c63a6b20c07a872cca2dcb0d263baf9/lib/eden/tokenizers/string_tokenizer.rb#L9-L37
2,853
jasonl/eden
lib/eden/tokenizers/string_tokenizer.rb
Eden.StringTokenizer.tokenize_heredoc_delimiter
def tokenize_heredoc_delimiter offset = 2 if cchar == '-' advance offset = 3 end if cchar =~ /[A-Za-z_]/ advance advance until /[A-Za-z0-9_]/.match( cchar ).nil? elsif /['"`]/.match(cchar) advance_through_quoted_delimiter(cchar) else r...
ruby
def tokenize_heredoc_delimiter offset = 2 if cchar == '-' advance offset = 3 end if cchar =~ /[A-Za-z_]/ advance advance until /[A-Za-z0-9_]/.match( cchar ).nil? elsif /['"`]/.match(cchar) advance_through_quoted_delimiter(cchar) else r...
[ "def", "tokenize_heredoc_delimiter", "offset", "=", "2", "if", "cchar", "==", "'-'", "advance", "offset", "=", "3", "end", "if", "cchar", "=~", "/", "/", "advance", "advance", "until", "/", "/", ".", "match", "(", "cchar", ")", ".", "nil?", "elsif", "/...
Called from tokenize_lt_operators when it identifies that << is a heredoc delimiter. Expects that '<<' will already be included in the current thunk.
[ "Called", "from", "tokenize_lt_operators", "when", "it", "identifies", "that", "<<", "is", "a", "heredoc", "delimiter", ".", "Expects", "that", "<<", "will", "already", "be", "included", "in", "the", "current", "thunk", "." ]
8a08a4000c63a6b20c07a872cca2dcb0d263baf9
https://github.com/jasonl/eden/blob/8a08a4000c63a6b20c07a872cca2dcb0d263baf9/lib/eden/tokenizers/string_tokenizer.rb#L95-L112
2,854
forcedotcom/salesforce-deskcom-api
lib/desk_api/resource.rb
DeskApi.Resource.to_hash
def to_hash load {}.tap do |hash| @_definition.each do |k, v| hash[k] = v end end end
ruby
def to_hash load {}.tap do |hash| @_definition.each do |k, v| hash[k] = v end end end
[ "def", "to_hash", "load", "{", "}", ".", "tap", "do", "|", "hash", "|", "@_definition", ".", "each", "do", "|", "k", ",", "v", "|", "hash", "[", "k", "]", "=", "v", "end", "end", "end" ]
Returns a hash based on the current definition of the resource @return [Hash] definition hash
[ "Returns", "a", "hash", "based", "on", "the", "current", "definition", "of", "the", "resource" ]
af1080459215d4cb769e785656bcee1d56696f95
https://github.com/forcedotcom/salesforce-deskcom-api/blob/af1080459215d4cb769e785656bcee1d56696f95/lib/desk_api/resource.rb#L117-L125
2,855
forcedotcom/salesforce-deskcom-api
lib/desk_api/resource.rb
DeskApi.Resource.respond_to?
def respond_to?(method) load meth = method.to_s return true if is_embedded?(meth) return true if is_link?(meth) return true if meth.end_with?('=') and is_field?(meth[0...-1]) return true if is_field?(meth) super end
ruby
def respond_to?(method) load meth = method.to_s return true if is_embedded?(meth) return true if is_link?(meth) return true if meth.end_with?('=') and is_field?(meth[0...-1]) return true if is_field?(meth) super end
[ "def", "respond_to?", "(", "method", ")", "load", "meth", "=", "method", ".", "to_s", "return", "true", "if", "is_embedded?", "(", "meth", ")", "return", "true", "if", "is_link?", "(", "meth", ")", "return", "true", "if", "meth", ".", "end_with?", "(", ...
Checks if this resource responds to a specific method @param method [String/Symbol] @return [Boolean]
[ "Checks", "if", "this", "resource", "responds", "to", "a", "specific", "method" ]
af1080459215d4cb769e785656bcee1d56696f95
https://github.com/forcedotcom/salesforce-deskcom-api/blob/af1080459215d4cb769e785656bcee1d56696f95/lib/desk_api/resource.rb#L138-L148
2,856
forcedotcom/salesforce-deskcom-api
lib/desk_api/resource.rb
DeskApi.Resource.get_embedded_resource
def get_embedded_resource(method) return @_embedded[method] if @_embedded.key?(method) @_embedded[method] = @_definition['_embedded'][method] if @_embedded[method].kind_of?(Array) @_embedded[method].tap do |ary| ary.map!{ |definition| new_resource(definition, true) } unless ary.firs...
ruby
def get_embedded_resource(method) return @_embedded[method] if @_embedded.key?(method) @_embedded[method] = @_definition['_embedded'][method] if @_embedded[method].kind_of?(Array) @_embedded[method].tap do |ary| ary.map!{ |definition| new_resource(definition, true) } unless ary.firs...
[ "def", "get_embedded_resource", "(", "method", ")", "return", "@_embedded", "[", "method", "]", "if", "@_embedded", ".", "key?", "(", "method", ")", "@_embedded", "[", "method", "]", "=", "@_definition", "[", "'_embedded'", "]", "[", "method", "]", "if", "...
Returns the embedded resource @param method [String/Symbol] @return [DeskApi::Resource]
[ "Returns", "the", "embedded", "resource" ]
af1080459215d4cb769e785656bcee1d56696f95
https://github.com/forcedotcom/salesforce-deskcom-api/blob/af1080459215d4cb769e785656bcee1d56696f95/lib/desk_api/resource.rb#L233-L244
2,857
forcedotcom/salesforce-deskcom-api
lib/desk_api/resource.rb
DeskApi.Resource.get_linked_resource
def get_linked_resource(method) return @_links[method] if @_links.key?(method) @_links[method] = @_definition['_links'][method] if @_links[method] and not @_links[method].kind_of?(self.class) @_links[method] = new_resource(self.class.build_self_link(@_links[method])) end end
ruby
def get_linked_resource(method) return @_links[method] if @_links.key?(method) @_links[method] = @_definition['_links'][method] if @_links[method] and not @_links[method].kind_of?(self.class) @_links[method] = new_resource(self.class.build_self_link(@_links[method])) end end
[ "def", "get_linked_resource", "(", "method", ")", "return", "@_links", "[", "method", "]", "if", "@_links", ".", "key?", "(", "method", ")", "@_links", "[", "method", "]", "=", "@_definition", "[", "'_links'", "]", "[", "method", "]", "if", "@_links", "[...
Returns the linked resource @param method [String/Symbol] @return [DeskApi::Resource]
[ "Returns", "the", "linked", "resource" ]
af1080459215d4cb769e785656bcee1d56696f95
https://github.com/forcedotcom/salesforce-deskcom-api/blob/af1080459215d4cb769e785656bcee1d56696f95/lib/desk_api/resource.rb#L250-L257
2,858
forcedotcom/salesforce-deskcom-api
lib/desk_api/resource.rb
DeskApi.Resource.method_missing
def method_missing(method, *args, &block) load meth = method.to_s return get_embedded_resource(meth) if is_embedded?(meth) return get_linked_resource(meth) if is_link?(meth) return @_changed[meth[0...-1]] = args.first if meth.end_with?('=') and is_field?(meth[0...-1]) return get_fi...
ruby
def method_missing(method, *args, &block) load meth = method.to_s return get_embedded_resource(meth) if is_embedded?(meth) return get_linked_resource(meth) if is_link?(meth) return @_changed[meth[0...-1]] = args.first if meth.end_with?('=') and is_field?(meth[0...-1]) return get_fi...
[ "def", "method_missing", "(", "method", ",", "*", "args", ",", "&", "block", ")", "load", "meth", "=", "method", ".", "to_s", "return", "get_embedded_resource", "(", "meth", ")", "if", "is_embedded?", "(", "meth", ")", "return", "get_linked_resource", "(", ...
Returns the requested embedded resource, linked resource or field value, also allows to set a new field value @param method [String/Symbol] @param args [Mixed] @param block [Proc] @return [Mixed]
[ "Returns", "the", "requested", "embedded", "resource", "linked", "resource", "or", "field", "value", "also", "allows", "to", "set", "a", "new", "field", "value" ]
af1080459215d4cb769e785656bcee1d56696f95
https://github.com/forcedotcom/salesforce-deskcom-api/blob/af1080459215d4cb769e785656bcee1d56696f95/lib/desk_api/resource.rb#L275-L286
2,859
dagrz/nba_stats
lib/nba_stats/stats/league_dash_player_stats.rb
NbaStats.LeagueDashPlayerStats.league_dash_player_stats
def league_dash_player_stats( season, measure_type=NbaStats::Constants::MEASURE_TYPE_BASE, per_mode=NbaStats::Constants::PER_MODE_GAME, plus_minus=NbaStats::Constants::NO, pace_adjust=NbaStats::Constants::NO, rank=NbaStats::Constants::NO, outcome=nil, loca...
ruby
def league_dash_player_stats( season, measure_type=NbaStats::Constants::MEASURE_TYPE_BASE, per_mode=NbaStats::Constants::PER_MODE_GAME, plus_minus=NbaStats::Constants::NO, pace_adjust=NbaStats::Constants::NO, rank=NbaStats::Constants::NO, outcome=nil, loca...
[ "def", "league_dash_player_stats", "(", "season", ",", "measure_type", "=", "NbaStats", "::", "Constants", "::", "MEASURE_TYPE_BASE", ",", "per_mode", "=", "NbaStats", "::", "Constants", "::", "PER_MODE_GAME", ",", "plus_minus", "=", "NbaStats", "::", "Constants", ...
Calls the leaguedashplayerstats API and returns a LeagueDashPlayerStats resource. @param season [String] @param measure_type [String] @param per_mode [String] @param plus_minus [String] @param pace_adjust [String] @param rank [String] @param outcome [String] @param location [String] @param month [Integer] @p...
[ "Calls", "the", "leaguedashplayerstats", "API", "and", "returns", "a", "LeagueDashPlayerStats", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/league_dash_player_stats.rb#L38-L100
2,860
dagrz/nba_stats
lib/nba_stats/stats/box_score.rb
NbaStats.BoxScore.box_score
def box_score( game_id, range_type=0, start_period=0, end_period=0, start_range=0, end_range=0 ) NbaStats::Resources::BoxScore.new( get(BOX_SCORE_PATH, { :GameID => game_id, :RangeType => range_type, :StartPeri...
ruby
def box_score( game_id, range_type=0, start_period=0, end_period=0, start_range=0, end_range=0 ) NbaStats::Resources::BoxScore.new( get(BOX_SCORE_PATH, { :GameID => game_id, :RangeType => range_type, :StartPeri...
[ "def", "box_score", "(", "game_id", ",", "range_type", "=", "0", ",", "start_period", "=", "0", ",", "end_period", "=", "0", ",", "start_range", "=", "0", ",", "end_range", "=", "0", ")", "NbaStats", "::", "Resources", "::", "BoxScore", ".", "new", "("...
Calls the boxscore API and returns a BoxScore resource. @param game_id [String] @param range_type [Integer] @param start_period [Integer] @param end_period [Integer] @param start_range [Integer] @param end_range [Integer] @return [NbaStats::Resources::BoxScore]
[ "Calls", "the", "boxscore", "API", "and", "returns", "a", "BoxScore", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/box_score.rb#L20-L38
2,861
kolorahl/rarbac
app/helpers/rarbac/user_helper.rb
Rarbac.UserHelper.has_roles?
def has_roles?(*args) throw Exception.new("Must supply at least one role.") if args.empty? roles.where(name: args).count == args.count end
ruby
def has_roles?(*args) throw Exception.new("Must supply at least one role.") if args.empty? roles.where(name: args).count == args.count end
[ "def", "has_roles?", "(", "*", "args", ")", "throw", "Exception", ".", "new", "(", "\"Must supply at least one role.\"", ")", "if", "args", ".", "empty?", "roles", ".", "where", "(", "name", ":", "args", ")", ".", "count", "==", "args", ".", "count", "en...
Determines if the user has all of the given roles linked to it. @param [String] args an argument list of one or more roles to check for. @return [true|false] true if the user is linked to all of the given roles.
[ "Determines", "if", "the", "user", "has", "all", "of", "the", "given", "roles", "linked", "to", "it", "." ]
9bb2654da1cec74766ae6a6aa5e46821bb478f47
https://github.com/kolorahl/rarbac/blob/9bb2654da1cec74766ae6a6aa5e46821bb478f47/app/helpers/rarbac/user_helper.rb#L22-L25
2,862
kolorahl/rarbac
app/helpers/rarbac/user_helper.rb
Rarbac.UserHelper.has_permission?
def has_permission?(action) return true if Action.where(name: action).count == 0 actions.where(name: action).count > 0 end
ruby
def has_permission?(action) return true if Action.where(name: action).count == 0 actions.where(name: action).count > 0 end
[ "def", "has_permission?", "(", "action", ")", "return", "true", "if", "Action", ".", "where", "(", "name", ":", "action", ")", ".", "count", "==", "0", "actions", ".", "where", "(", "name", ":", "action", ")", ".", "count", ">", "0", "end" ]
Determines if the user has permission to a given action. If the action does not exist at all, it is assumed the action is publicly available. @param [String] action name of the action to check permission for. @return [true|false] true if the user has at least one role linked to it with permission to the given ac...
[ "Determines", "if", "the", "user", "has", "permission", "to", "a", "given", "action", ".", "If", "the", "action", "does", "not", "exist", "at", "all", "it", "is", "assumed", "the", "action", "is", "publicly", "available", "." ]
9bb2654da1cec74766ae6a6aa5e46821bb478f47
https://github.com/kolorahl/rarbac/blob/9bb2654da1cec74766ae6a6aa5e46821bb478f47/app/helpers/rarbac/user_helper.rb#L33-L36
2,863
dagrz/nba_stats
lib/nba_stats/stats/scoreboard.rb
NbaStats.Scoreboard.scoreboard
def scoreboard( game_date=Date.today, day_offset=0, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::Scoreboard.new( get(SCOREBOARD_PATH, { :LeagueID => league_id, :GameDate => game_date.strftime('%m-%d-%Y'), :DayOf...
ruby
def scoreboard( game_date=Date.today, day_offset=0, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::Scoreboard.new( get(SCOREBOARD_PATH, { :LeagueID => league_id, :GameDate => game_date.strftime('%m-%d-%Y'), :DayOf...
[ "def", "scoreboard", "(", "game_date", "=", "Date", ".", "today", ",", "day_offset", "=", "0", ",", "league_id", "=", "NbaStats", "::", "Constants", "::", "LEAGUE_ID_NBA", ")", "NbaStats", "::", "Resources", "::", "Scoreboard", ".", "new", "(", "get", "(",...
Calls the scoreboard API and returns a Scoreboard resource. @param game_date [Date] @param day_offset [Integer] @param league_id [String] @return [NbaStats::Resources::Scoreboard]
[ "Calls", "the", "scoreboard", "API", "and", "returns", "a", "Scoreboard", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/scoreboard.rb#L17-L29
2,864
kudelabs/ad_man
app/helpers/ad_man/application_helper.rb
AdMan.ApplicationHelper.get_keyword_from_url
def get_keyword_from_url if request.env["REQUEST_PATH"] req_url = request.env["REQUEST_PATH"].split("/") keyword_names = Keyword.all.map(&:name) keyword = req_url & keyword_names end end
ruby
def get_keyword_from_url if request.env["REQUEST_PATH"] req_url = request.env["REQUEST_PATH"].split("/") keyword_names = Keyword.all.map(&:name) keyword = req_url & keyword_names end end
[ "def", "get_keyword_from_url", "if", "request", ".", "env", "[", "\"REQUEST_PATH\"", "]", "req_url", "=", "request", ".", "env", "[", "\"REQUEST_PATH\"", "]", ".", "split", "(", "\"/\"", ")", "keyword_names", "=", "Keyword", ".", "all", ".", "map", "(", ":...
grab the keyword form request url
[ "grab", "the", "keyword", "form", "request", "url" ]
9b9eaffd2b42ba67e4a61c4f619e5ee73b6cefd4
https://github.com/kudelabs/ad_man/blob/9b9eaffd2b42ba67e4a61c4f619e5ee73b6cefd4/app/helpers/ad_man/application_helper.rb#L20-L26
2,865
weltschmerz1/entangled
lib/entangled/helpers.rb
Entangled.Helpers.redis
def redis if defined?($redis) && $redis Redis.new($redis.client.options) elsif defined?(REDIS) && REDIS Redis.new(REDIS.client.options) else Redis.new end end
ruby
def redis if defined?($redis) && $redis Redis.new($redis.client.options) elsif defined?(REDIS) && REDIS Redis.new(REDIS.client.options) else Redis.new end end
[ "def", "redis", "if", "defined?", "(", "$redis", ")", "&&", "$redis", "Redis", ".", "new", "(", "$redis", ".", "client", ".", "options", ")", "elsif", "defined?", "(", "REDIS", ")", "&&", "REDIS", "Redis", ".", "new", "(", "REDIS", ".", "client", "."...
Get Redis that user might be using or instantiate a new one
[ "Get", "Redis", "that", "user", "might", "be", "using", "or", "instantiate", "a", "new", "one" ]
2a8596c669785ce9b367379b8b5a63e13b0afc46
https://github.com/weltschmerz1/entangled/blob/2a8596c669785ce9b367379b8b5a63e13b0afc46/lib/entangled/helpers.rb#L5-L13
2,866
dagrz/nba_stats
lib/nba_stats/stats/draft_combine_drill_results.rb
NbaStats.DraftCombineDrillResults.draft_combine_drill_results
def draft_combine_drill_results( season_year, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::DraftCombineDrillResults.new( get(DRAFT_COMBINE_DRILL_RESULTS_PATH, { :LeagueID => league_id, :SeasonYear => season_year }) ) ...
ruby
def draft_combine_drill_results( season_year, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::DraftCombineDrillResults.new( get(DRAFT_COMBINE_DRILL_RESULTS_PATH, { :LeagueID => league_id, :SeasonYear => season_year }) ) ...
[ "def", "draft_combine_drill_results", "(", "season_year", ",", "league_id", "=", "NbaStats", "::", "Constants", "::", "LEAGUE_ID_NBA", ")", "NbaStats", "::", "Resources", "::", "DraftCombineDrillResults", ".", "new", "(", "get", "(", "DRAFT_COMBINE_DRILL_RESULTS_PATH", ...
Calls the draftcombinedrillresults API and returns a DraftCombineDrillResults resource. @param season_year [String] @param league_id [String] @return [NbaStats::Resources::DraftCombineDrillResults]
[ "Calls", "the", "draftcombinedrillresults", "API", "and", "returns", "a", "DraftCombineDrillResults", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/draft_combine_drill_results.rb#L15-L25
2,867
dagrz/nba_stats
lib/nba_stats/stats/play_by_play.rb
NbaStats.PlayByPlay.play_by_play
def play_by_play( game_id, start_period=0, end_period=0 ) NbaStats::Resources::PlayByPlay.new( get(PLAY_BY_PLAY_PATH, { :GameID => game_id, :StartPeriod => start_period, :EndPeriod => end_period }) ) end
ruby
def play_by_play( game_id, start_period=0, end_period=0 ) NbaStats::Resources::PlayByPlay.new( get(PLAY_BY_PLAY_PATH, { :GameID => game_id, :StartPeriod => start_period, :EndPeriod => end_period }) ) end
[ "def", "play_by_play", "(", "game_id", ",", "start_period", "=", "0", ",", "end_period", "=", "0", ")", "NbaStats", "::", "Resources", "::", "PlayByPlay", ".", "new", "(", "get", "(", "PLAY_BY_PLAY_PATH", ",", "{", ":GameID", "=>", "game_id", ",", ":StartP...
Calls the playbyplay API and returns a PlayByPlay resource. @param game_id [String] @param start_period [Integer] @param end_period [Integer] @return [NbaStats::Resources::PlayByPlay]
[ "Calls", "the", "playbyplay", "API", "and", "returns", "a", "PlayByPlay", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/play_by_play.rb#L16-L28
2,868
mat813/rb-kqueue
lib/rb-kqueue/watcher.rb
KQueue.Watcher.native
def native(flags) native = Native::KEvent.new native[:ident] = @ident native[:filter] = Native::Flags.to_flag("EVFILT", @filter) native[:flags] = Native::Flags.to_mask("EV", @flags | flags) native[:fflags] = Native::Flags.to_mask("NOTE_#{@filter.to_s.upcase}", @fflags) native[:data] ...
ruby
def native(flags) native = Native::KEvent.new native[:ident] = @ident native[:filter] = Native::Flags.to_flag("EVFILT", @filter) native[:flags] = Native::Flags.to_mask("EV", @flags | flags) native[:fflags] = Native::Flags.to_mask("NOTE_#{@filter.to_s.upcase}", @fflags) native[:data] ...
[ "def", "native", "(", "flags", ")", "native", "=", "Native", "::", "KEvent", ".", "new", "native", "[", ":ident", "]", "=", "@ident", "native", "[", ":filter", "]", "=", "Native", "::", "Flags", ".", "to_flag", "(", "\"EVFILT\"", ",", "@filter", ")", ...
Returns a C struct corresponding to this watcher. @param flags [Array<Symbol>] Flags for the C struct's `flags` field, in addition to the `@flags` var. @return [Native::KEvent]
[ "Returns", "a", "C", "struct", "corresponding", "to", "this", "watcher", "." ]
f11c1a8552812bc0b635ef9751d6dc61d4beaa67
https://github.com/mat813/rb-kqueue/blob/f11c1a8552812bc0b635ef9751d6dc61d4beaa67/lib/rb-kqueue/watcher.rb#L100-L108
2,869
mat813/rb-kqueue
lib/rb-kqueue/watcher.rb
KQueue.Watcher.kevent!
def kevent!(*flags) if Native.kevent(@queue.fd, native(flags).pointer, 1, nil, 0, nil) < 0 KQueue.handle_error end end
ruby
def kevent!(*flags) if Native.kevent(@queue.fd, native(flags).pointer, 1, nil, 0, nil) < 0 KQueue.handle_error end end
[ "def", "kevent!", "(", "*", "flags", ")", "if", "Native", ".", "kevent", "(", "@queue", ".", "fd", ",", "native", "(", "flags", ")", ".", "pointer", ",", "1", ",", "nil", ",", "0", ",", "nil", ")", "<", "0", "KQueue", ".", "handle_error", "end", ...
Runs the `kevent` C call with this Watcher's kevent struct as input. This effectively means telling kqueue to perform some action with this Watcher as an argument. @param flags [Array<Symbol>] Flags specifying the action to perform as well as any additional flags. @return [void] @raise [SystemCallError] If som...
[ "Runs", "the", "kevent", "C", "call", "with", "this", "Watcher", "s", "kevent", "struct", "as", "input", ".", "This", "effectively", "means", "telling", "kqueue", "to", "perform", "some", "action", "with", "this", "Watcher", "as", "an", "argument", "." ]
f11c1a8552812bc0b635ef9751d6dc61d4beaa67
https://github.com/mat813/rb-kqueue/blob/f11c1a8552812bc0b635ef9751d6dc61d4beaa67/lib/rb-kqueue/watcher.rb#L118-L122
2,870
dagrz/nba_stats
lib/nba_stats/stats/draft_combine_non_stationary_shooting.rb
NbaStats.DraftCombineNonStationaryShooting.draft_combine_non_stationary_shooting
def draft_combine_non_stationary_shooting( season_year, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::DraftCombineNonStationaryShooting.new( get(DRAFT_COMBINE_NON_STATIONARY_SHOOTING_PATH, { :LeagueID => league_id, :SeasonYear => seas...
ruby
def draft_combine_non_stationary_shooting( season_year, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::DraftCombineNonStationaryShooting.new( get(DRAFT_COMBINE_NON_STATIONARY_SHOOTING_PATH, { :LeagueID => league_id, :SeasonYear => seas...
[ "def", "draft_combine_non_stationary_shooting", "(", "season_year", ",", "league_id", "=", "NbaStats", "::", "Constants", "::", "LEAGUE_ID_NBA", ")", "NbaStats", "::", "Resources", "::", "DraftCombineNonStationaryShooting", ".", "new", "(", "get", "(", "DRAFT_COMBINE_NO...
Calls the draftcombinenonstationaryshooting API and returns a DraftCombineNonStationaryShooting resource. @param season_year [String] @param league_id [String] @return [NbaStats::Resources::DraftCombineNonStationaryShooting]
[ "Calls", "the", "draftcombinenonstationaryshooting", "API", "and", "returns", "a", "DraftCombineNonStationaryShooting", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/draft_combine_non_stationary_shooting.rb#L15-L25
2,871
listia/walmart_open
lib/walmart_open/request.rb
WalmartOpen.Request.convert_param_keys
def convert_param_keys(underscored_params) pairs = underscored_params.map do |key, value| key = key.to_s.gsub(/_([a-z])/i) { $1.upcase } [key, value] end Hash[pairs] end
ruby
def convert_param_keys(underscored_params) pairs = underscored_params.map do |key, value| key = key.to_s.gsub(/_([a-z])/i) { $1.upcase } [key, value] end Hash[pairs] end
[ "def", "convert_param_keys", "(", "underscored_params", ")", "pairs", "=", "underscored_params", ".", "map", "do", "|", "key", ",", "value", "|", "key", "=", "key", ".", "to_s", ".", "gsub", "(", "/", "/i", ")", "{", "$1", ".", "upcase", "}", "[", "k...
Converts foo_bar_param to fooBarParam.
[ "Converts", "foo_bar_param", "to", "fooBarParam", "." ]
f563da4ae7b620d7c3c52ebafb6af50a77d614b2
https://github.com/listia/walmart_open/blob/f563da4ae7b620d7c3c52ebafb6af50a77d614b2/lib/walmart_open/request.rb#L71-L77
2,872
dagrz/nba_stats
lib/nba_stats/stats/box_score_misc.rb
NbaStats.BoxScoreMisc.box_score_misc
def box_score_misc( game_id, range_type=0, start_period=0, end_period=0, start_range=0, end_range=0 ) NbaStats::Resources::BoxScoreMisc.new( get(BOX_SCORE_MISC_PATH, { :GameID => game_id, :RangeType => range_type, ...
ruby
def box_score_misc( game_id, range_type=0, start_period=0, end_period=0, start_range=0, end_range=0 ) NbaStats::Resources::BoxScoreMisc.new( get(BOX_SCORE_MISC_PATH, { :GameID => game_id, :RangeType => range_type, ...
[ "def", "box_score_misc", "(", "game_id", ",", "range_type", "=", "0", ",", "start_period", "=", "0", ",", "end_period", "=", "0", ",", "start_range", "=", "0", ",", "end_range", "=", "0", ")", "NbaStats", "::", "Resources", "::", "BoxScoreMisc", ".", "ne...
Calls the boxscoremisc API and returns a BoxScoreMisc resource. @param game_id [String] @param range_type [Integer] @param start_period [Integer] @param end_period [Integer] @param start_range [Integer] @param end_range [Integer] @return [NbaStats::Resources::BoxScoreMisc]
[ "Calls", "the", "boxscoremisc", "API", "and", "returns", "a", "BoxScoreMisc", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/box_score_misc.rb#L19-L37
2,873
dagrz/nba_stats
lib/nba_stats/stats/league_dash_team_stats.rb
NbaStats.LeagueDashTeamStats.league_dash_team_stats
def league_dash_team_stats( season, date_from=nil, date_to=nil, game_scope=nil, game_segment=nil, last_n_games=0, location=nil, measure_type=NbaStats::Constants::MEASURE_TYPE_BASE, month=0, opponent_team_id=0, outcome=nil, p...
ruby
def league_dash_team_stats( season, date_from=nil, date_to=nil, game_scope=nil, game_segment=nil, last_n_games=0, location=nil, measure_type=NbaStats::Constants::MEASURE_TYPE_BASE, month=0, opponent_team_id=0, outcome=nil, p...
[ "def", "league_dash_team_stats", "(", "season", ",", "date_from", "=", "nil", ",", "date_to", "=", "nil", ",", "game_scope", "=", "nil", ",", "game_segment", "=", "nil", ",", "last_n_games", "=", "0", ",", "location", "=", "nil", ",", "measure_type", "=", ...
Calls the leaguedashteamstats API and returns a LeagueDashTeamStats resource. @param date_from [Date] @param date_to [Date] @param game_scope [String] @param game_segment [String] @param last_n_games [Integer] @param league_id [String] @param location [String] @param measure_type [String] @param month [Intege...
[ "Calls", "the", "leaguedashteamstats", "API", "and", "returns", "a", "LeagueDashTeamStats", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/league_dash_team_stats.rb#L37-L91
2,874
dagrz/nba_stats
lib/nba_stats/stats/player_game_log.rb
NbaStats.PlayerGameLog.player_game_log
def player_game_log( player_id, season, season_type=NbaStats::Constants::SEASON_TYPE_REGULAR, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::PlayerGameLog.new( get(PLAYER_GAME_LOG_PATH, { :Season => season, :LeagueID => leagu...
ruby
def player_game_log( player_id, season, season_type=NbaStats::Constants::SEASON_TYPE_REGULAR, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::PlayerGameLog.new( get(PLAYER_GAME_LOG_PATH, { :Season => season, :LeagueID => leagu...
[ "def", "player_game_log", "(", "player_id", ",", "season", ",", "season_type", "=", "NbaStats", "::", "Constants", "::", "SEASON_TYPE_REGULAR", ",", "league_id", "=", "NbaStats", "::", "Constants", "::", "LEAGUE_ID_NBA", ")", "NbaStats", "::", "Resources", "::", ...
Calls the playergamelog API and returns a PlayerGameLog resource. @param league_id [String] @param player_id [Integer] @param season [String] @param season_type [String] @return [NbaStats::Resources::PlayerGameLog]
[ "Calls", "the", "playergamelog", "API", "and", "returns", "a", "PlayerGameLog", "resource", "." ]
d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa
https://github.com/dagrz/nba_stats/blob/d6fe6cf81f74a2ce7a054aeec5e9db59a6ec42aa/lib/nba_stats/stats/player_game_log.rb#L17-L31
2,875
dcuddeback/rspec-tag_matchers
lib/rspec/tag_matchers/multiple_input_matcher.rb
RSpec::TagMatchers.MultipleInputMatcher.matches?
def matches?(rendered) @rendered = rendered @failures = matchers.reject do |matcher| matcher.matches?(rendered) end @failures.empty? end
ruby
def matches?(rendered) @rendered = rendered @failures = matchers.reject do |matcher| matcher.matches?(rendered) end @failures.empty? end
[ "def", "matches?", "(", "rendered", ")", "@rendered", "=", "rendered", "@failures", "=", "matchers", ".", "reject", "do", "|", "matcher", "|", "matcher", ".", "matches?", "(", "rendered", ")", "end", "@failures", ".", "empty?", "end" ]
Initializes a matcher that matches multiple input elements. @param [Hash] components A hash of matchers. The keys should be the keys used in Rails' multi-parameter assignment, e.g., <tt>"1i"</tt>, <tt>"2s"</tt>, etc, and the values are the matchers that must be s...
[ "Initializes", "a", "matcher", "that", "matches", "multiple", "input", "elements", "." ]
6396a833d99ea669699afb1b3dfc62c4512c8882
https://github.com/dcuddeback/rspec-tag_matchers/blob/6396a833d99ea669699afb1b3dfc62c4512c8882/lib/rspec/tag_matchers/multiple_input_matcher.rb#L44-L51
2,876
dcuddeback/rspec-tag_matchers
lib/rspec/tag_matchers/multiple_input_matcher.rb
RSpec::TagMatchers.MultipleInputMatcher.for
def for(*args) @for = args.dup @for.extend(DeepFlattening) @for = @for.deep_flatten @components.each do |index, matcher| delegated_for(index, matcher, @for) end self end
ruby
def for(*args) @for = args.dup @for.extend(DeepFlattening) @for = @for.deep_flatten @components.each do |index, matcher| delegated_for(index, matcher, @for) end self end
[ "def", "for", "(", "*", "args", ")", "@for", "=", "args", ".", "dup", "@for", ".", "extend", "(", "DeepFlattening", ")", "@for", "=", "@for", ".", "deep_flatten", "@components", ".", "each", "do", "|", "index", ",", "matcher", "|", "delegated_for", "("...
Specifies the inputs' names with more accuracy than the default regular expressions. It delegates to each matcher's +for+ method. But it first appends the matcher's key to the last component of the input's name. @example Input naming delegation hour_matcher = HasSelect.new minute_matcher = HasSelect.new ...
[ "Specifies", "the", "inputs", "names", "with", "more", "accuracy", "than", "the", "default", "regular", "expressions", ".", "It", "delegates", "to", "each", "matcher", "s", "+", "for", "+", "method", ".", "But", "it", "first", "appends", "the", "matcher", ...
6396a833d99ea669699afb1b3dfc62c4512c8882
https://github.com/dcuddeback/rspec-tag_matchers/blob/6396a833d99ea669699afb1b3dfc62c4512c8882/lib/rspec/tag_matchers/multiple_input_matcher.rb#L68-L77
2,877
dcuddeback/rspec-tag_matchers
lib/rspec/tag_matchers/multiple_input_matcher.rb
RSpec::TagMatchers.MultipleInputMatcher.delegated_for
def delegated_for(key, matcher, args) args = args.dup args[-1] = args[-1].to_s args[-1] += "(#{key})" matcher.for(*args) end
ruby
def delegated_for(key, matcher, args) args = args.dup args[-1] = args[-1].to_s args[-1] += "(#{key})" matcher.for(*args) end
[ "def", "delegated_for", "(", "key", ",", "matcher", ",", "args", ")", "args", "=", "args", ".", "dup", "args", "[", "-", "1", "]", "=", "args", "[", "-", "1", "]", ".", "to_s", "args", "[", "-", "1", "]", "+=", "\"(#{key})\"", "matcher", ".", "...
Set's +matcher+'s input name according to +args+ and +key+. @param [String] key The matcher's key. @param [HasInput] matcher The matcher. @param [Arrah, Hash] args A hierarchy of names that would normally be passed to {HasInput#for}.
[ "Set", "s", "+", "matcher", "+", "s", "input", "name", "according", "to", "+", "args", "+", "and", "+", "key", "+", "." ]
6396a833d99ea669699afb1b3dfc62c4512c8882
https://github.com/dcuddeback/rspec-tag_matchers/blob/6396a833d99ea669699afb1b3dfc62c4512c8882/lib/rspec/tag_matchers/multiple_input_matcher.rb#L108-L113
2,878
coderanger/dco
lib/dco/cli.rb
Dco.CLI.assert_repo!
def assert_repo! begin # Check if the repo fails to load at all. repo rescue Exception raise Thor::Error.new("#{repo_path} does not appear to be a git repository") end unless repo.repo.writable? raise Thor::Error.new("Git repository at #{repo.repo.path} is read-on...
ruby
def assert_repo! begin # Check if the repo fails to load at all. repo rescue Exception raise Thor::Error.new("#{repo_path} does not appear to be a git repository") end unless repo.repo.writable? raise Thor::Error.new("Git repository at #{repo.repo.path} is read-on...
[ "def", "assert_repo!", "begin", "# Check if the repo fails to load at all.", "repo", "rescue", "Exception", "raise", "Thor", "::", "Error", ".", "new", "(", "\"#{repo_path} does not appear to be a git repository\"", ")", "end", "unless", "repo", ".", "repo", ".", "writabl...
Check that we are in a git repo that we have write access to. @api private @return [void]
[ "Check", "that", "we", "are", "in", "a", "git", "repo", "that", "we", "have", "write", "access", "to", "." ]
a18d60bd9217bcf08f3c264080752f64d855ec39
https://github.com/coderanger/dco/blob/a18d60bd9217bcf08f3c264080752f64d855ec39/lib/dco/cli.rb#L328-L338
2,879
coderanger/dco
lib/dco/cli.rb
Dco.CLI.current_branch
def current_branch repo.current_branch.tap {|b| raise Thor::Error.new("No explicit branch passed and current head looks detached: #{b}") if b[0] == '(' } end
ruby
def current_branch repo.current_branch.tap {|b| raise Thor::Error.new("No explicit branch passed and current head looks detached: #{b}") if b[0] == '(' } end
[ "def", "current_branch", "repo", ".", "current_branch", ".", "tap", "{", "|", "b", "|", "raise", "Thor", "::", "Error", ".", "new", "(", "\"No explicit branch passed and current head looks detached: #{b}\"", ")", "if", "b", "[", "0", "]", "==", "'('", "}", "en...
Get the current branch but raise an error if it looks like we're on a detched head. @api private @return [String]
[ "Get", "the", "current", "branch", "but", "raise", "an", "error", "if", "it", "looks", "like", "we", "re", "on", "a", "detched", "head", "." ]
a18d60bd9217bcf08f3c264080752f64d855ec39
https://github.com/coderanger/dco/blob/a18d60bd9217bcf08f3c264080752f64d855ec39/lib/dco/cli.rb#L360-L362
2,880
coderanger/dco
lib/dco/cli.rb
Dco.CLI.has_sign_off?
def has_sign_off?(commit_or_message) message = commit_or_message.is_a?(String) ? commit_or_message : commit_or_message.message if message =~ /^Signed-off-by: (.+)$/ $1 else nil end end
ruby
def has_sign_off?(commit_or_message) message = commit_or_message.is_a?(String) ? commit_or_message : commit_or_message.message if message =~ /^Signed-off-by: (.+)$/ $1 else nil end end
[ "def", "has_sign_off?", "(", "commit_or_message", ")", "message", "=", "commit_or_message", ".", "is_a?", "(", "String", ")", "?", "commit_or_message", ":", "commit_or_message", ".", "message", "if", "message", "=~", "/", "/", "$1", "else", "nil", "end", "end"...
Check if a commit or commit message is already signed off. @api private @param commit_or_message [String, Git::Commit] Commit object or message string. @return [String, nil]
[ "Check", "if", "a", "commit", "or", "commit", "message", "is", "already", "signed", "off", "." ]
a18d60bd9217bcf08f3c264080752f64d855ec39
https://github.com/coderanger/dco/blob/a18d60bd9217bcf08f3c264080752f64d855ec39/lib/dco/cli.rb#L394-L401
2,881
sawaken/ruby-binary-parser
lib/binary_parser/general_class/abstract_binary.rb
BinaryParser.AbstractBinary.alt
def alt(binary_or_uint) case binary_or_uint when Integer alt_uint(binary_or_uint) when String alt_binary(binary_or_uint) else raise BadManipulationError, "Argument shouled be Integer or binary-encoded String." end end
ruby
def alt(binary_or_uint) case binary_or_uint when Integer alt_uint(binary_or_uint) when String alt_binary(binary_or_uint) else raise BadManipulationError, "Argument shouled be Integer or binary-encoded String." end end
[ "def", "alt", "(", "binary_or_uint", ")", "case", "binary_or_uint", "when", "Integer", "alt_uint", "(", "binary_or_uint", ")", "when", "String", "alt_binary", "(", "binary_or_uint", ")", "else", "raise", "BadManipulationError", ",", "\"Argument shouled be Integer or bin...
Methods for generating modified binary.
[ "Methods", "for", "generating", "modified", "binary", "." ]
c9ae043915d1a91677a2296e2f15d2929242d8f7
https://github.com/sawaken/ruby-binary-parser/blob/c9ae043915d1a91677a2296e2f15d2929242d8f7/lib/binary_parser/general_class/abstract_binary.rb#L44-L53
2,882
domitry/mikon
lib/mikon/core/dataframe.rb
Mikon.DataFrame.[]
def [](arg) case when arg.is_a?(Range) index = @index.select{|i| arg.include?(i)} Mikon::DataFrame.new(index.map{|i| self.row(i)}, {index: index}) when arg.is_a?(Symbol) self.column(arg) end end
ruby
def [](arg) case when arg.is_a?(Range) index = @index.select{|i| arg.include?(i)} Mikon::DataFrame.new(index.map{|i| self.row(i)}, {index: index}) when arg.is_a?(Symbol) self.column(arg) end end
[ "def", "[]", "(", "arg", ")", "case", "when", "arg", ".", "is_a?", "(", "Range", ")", "index", "=", "@index", ".", "select", "{", "|", "i", "|", "arg", ".", "include?", "(", "i", ")", "}", "Mikon", "::", "DataFrame", ".", "new", "(", "index", "...
Accessor for column and rows @example df = DataFrame.new({a: [1, 2, 3], b: [2, 3, 4]}) df[0..1].to_json #-> {a: [1, 2], b: [2, 3]} df[:a] #-> <Mikon::Series>
[ "Accessor", "for", "column", "and", "rows" ]
69886f5b6767d141e0a5624f0de2f34743909537
https://github.com/domitry/mikon/blob/69886f5b6767d141e0a5624f0de2f34743909537/lib/mikon/core/dataframe.rb#L140-L149
2,883
domitry/mikon
lib/mikon/core/dataframe.rb
Mikon.DataFrame.column
def column(label) pos = @labels.index(label) raise "There is no column named " + label if pos.nil? Mikon::Series.new(label, @data[pos], index: @index) end
ruby
def column(label) pos = @labels.index(label) raise "There is no column named " + label if pos.nil? Mikon::Series.new(label, @data[pos], index: @index) end
[ "def", "column", "(", "label", ")", "pos", "=", "@labels", ".", "index", "(", "label", ")", "raise", "\"There is no column named \"", "+", "label", "if", "pos", ".", "nil?", "Mikon", "::", "Series", ".", "new", "(", "label", ",", "@data", "[", "pos", "...
Access column with its name
[ "Access", "column", "with", "its", "name" ]
69886f5b6767d141e0a5624f0de2f34743909537
https://github.com/domitry/mikon/blob/69886f5b6767d141e0a5624f0de2f34743909537/lib/mikon/core/dataframe.rb#L152-L156
2,884
domitry/mikon
lib/mikon/core/dataframe.rb
Mikon.DataFrame.to_html
def to_html(threshold=50) html = "<html><table><tr><td></td>" html += @labels.map{|label| "<th>" + label.to_s + "</th>"}.join html += "</tr>" self.each_row.with_index do |row, pos| next if pos > threshold && pos != self.length-1 html += "<tr><th>" + @index[pos].to_s + "</th>" ...
ruby
def to_html(threshold=50) html = "<html><table><tr><td></td>" html += @labels.map{|label| "<th>" + label.to_s + "</th>"}.join html += "</tr>" self.each_row.with_index do |row, pos| next if pos > threshold && pos != self.length-1 html += "<tr><th>" + @index[pos].to_s + "</th>" ...
[ "def", "to_html", "(", "threshold", "=", "50", ")", "html", "=", "\"<html><table><tr><td></td>\"", "html", "+=", "@labels", ".", "map", "{", "|", "label", "|", "\"<th>\"", "+", "label", ".", "to_s", "+", "\"</th>\"", "}", ".", "join", "html", "+=", "\"</...
IRuby notebook automatically call this method
[ "IRuby", "notebook", "automatically", "call", "this", "method" ]
69886f5b6767d141e0a5624f0de2f34743909537
https://github.com/domitry/mikon/blob/69886f5b6767d141e0a5624f0de2f34743909537/lib/mikon/core/dataframe.rb#L179-L191
2,885
domitry/mikon
lib/mikon/core/dataframe.rb
Mikon.DataFrame.sort
def sort(label, ascending=true) i = @labels.index(label) raise "No column named" + label.to_s if i.nil? order = @data[i].sorted_indices order.reverse! unless ascending self.sort_by.with_index{|val, i| order.index(i)} end
ruby
def sort(label, ascending=true) i = @labels.index(label) raise "No column named" + label.to_s if i.nil? order = @data[i].sorted_indices order.reverse! unless ascending self.sort_by.with_index{|val, i| order.index(i)} end
[ "def", "sort", "(", "label", ",", "ascending", "=", "true", ")", "i", "=", "@labels", ".", "index", "(", "label", ")", "raise", "\"No column named\"", "+", "label", ".", "to_s", "if", "i", ".", "nil?", "order", "=", "@data", "[", "i", "]", ".", "so...
Sort by label @param [Symbol] label column name to sort by @param [Bool] ascending default true
[ "Sort", "by", "label" ]
69886f5b6767d141e0a5624f0de2f34743909537
https://github.com/domitry/mikon/blob/69886f5b6767d141e0a5624f0de2f34743909537/lib/mikon/core/dataframe.rb#L273-L279
2,886
domitry/mikon
lib/mikon/core/dataframe.rb
Mikon.DataFrame.row
def row(index) pos = @index.index(index) arr = @data.map{|column| column[pos]} Mikon::Row.new(@labels, arr, index) end
ruby
def row(index) pos = @index.index(index) arr = @data.map{|column| column[pos]} Mikon::Row.new(@labels, arr, index) end
[ "def", "row", "(", "index", ")", "pos", "=", "@index", ".", "index", "(", "index", ")", "arr", "=", "@data", ".", "map", "{", "|", "column", "|", "column", "[", "pos", "]", "}", "Mikon", "::", "Row", ".", "new", "(", "@labels", ",", "arr", ",",...
Access row using index
[ "Access", "row", "using", "index" ]
69886f5b6767d141e0a5624f0de2f34743909537
https://github.com/domitry/mikon/blob/69886f5b6767d141e0a5624f0de2f34743909537/lib/mikon/core/dataframe.rb#L327-L331
2,887
opulent/opulent
lib/opulent/parser/yield.rb
Opulent.Parser.block_yield
def block_yield(parent, indent) return unless accept :yield # Consume the newline from the end of the element error :yield unless accept(:line_feed).strip.empty? # Create a new node yield_node = [:yield, nil, {}, [], indent] parent[@children] << yield_node end
ruby
def block_yield(parent, indent) return unless accept :yield # Consume the newline from the end of the element error :yield unless accept(:line_feed).strip.empty? # Create a new node yield_node = [:yield, nil, {}, [], indent] parent[@children] << yield_node end
[ "def", "block_yield", "(", "parent", ",", "indent", ")", "return", "unless", "accept", ":yield", "# Consume the newline from the end of the element", "error", ":yield", "unless", "accept", "(", ":line_feed", ")", ".", "strip", ".", "empty?", "# Create a new node", "yi...
Match a yield with a explicit or implicit target yield target @param parent [Node] Parent node to which we append the definition
[ "Match", "a", "yield", "with", "a", "explicit", "or", "implicit", "target" ]
7b219bd4f54b404e8f43955b8e70925a01814b59
https://github.com/opulent/opulent/blob/7b219bd4f54b404e8f43955b8e70925a01814b59/lib/opulent/parser/yield.rb#L11-L21
2,888
Yellowen/Faalis
lib/faalis/dashboard/sections/resource_create.rb
Faalis::Dashboard::Sections.ResourceCreate.create
def create authorize model @resource = model.new(creation_params) @resource.assign_attributes(**reflections_hash) unless reflections_hash.nil? # Customize the create behaviour before_create_hook(@resource) # TODO: Handle M2M relations in here if @resource.save after_...
ruby
def create authorize model @resource = model.new(creation_params) @resource.assign_attributes(**reflections_hash) unless reflections_hash.nil? # Customize the create behaviour before_create_hook(@resource) # TODO: Handle M2M relations in here if @resource.save after_...
[ "def", "create", "authorize", "model", "@resource", "=", "model", ".", "new", "(", "creation_params", ")", "@resource", ".", "assign_attributes", "(", "**", "reflections_hash", ")", "unless", "reflections_hash", ".", "nil?", "# Customize the create behaviour", "before...
The actual action method for creating new resource.
[ "The", "actual", "action", "method", "for", "creating", "new", "resource", "." ]
d12abdb8559dabbf6b2044e3ba437038527039b2
https://github.com/Yellowen/Faalis/blob/d12abdb8559dabbf6b2044e3ba437038527039b2/lib/faalis/dashboard/sections/resource_create.rb#L71-L89
2,889
Yellowen/Faalis
lib/faalis/dashboard/sections/resource_create.rb
Faalis::Dashboard::Sections.ResourceCreate.is_reflection?
def is_reflection?(c) has_many = ActiveRecord::Reflection::HasManyReflection has_and_belongs_to_many = ActiveRecord::Reflection::HasAndBelongsToManyReflection has_many_through = ActiveRecord::Reflection::ThroughReflection result = c.is_a?(has_many) || c.is_a?(has_and_belongs_to_many) ...
ruby
def is_reflection?(c) has_many = ActiveRecord::Reflection::HasManyReflection has_and_belongs_to_many = ActiveRecord::Reflection::HasAndBelongsToManyReflection has_many_through = ActiveRecord::Reflection::ThroughReflection result = c.is_a?(has_many) || c.is_a?(has_and_belongs_to_many) ...
[ "def", "is_reflection?", "(", "c", ")", "has_many", "=", "ActiveRecord", "::", "Reflection", "::", "HasManyReflection", "has_and_belongs_to_many", "=", "ActiveRecord", "::", "Reflection", "::", "HasAndBelongsToManyReflection", "has_many_through", "=", "ActiveRecord", "::"...
Check whether the given column is a reflection or not.
[ "Check", "whether", "the", "given", "column", "is", "a", "reflection", "or", "not", "." ]
d12abdb8559dabbf6b2044e3ba437038527039b2
https://github.com/Yellowen/Faalis/blob/d12abdb8559dabbf6b2044e3ba437038527039b2/lib/faalis/dashboard/sections/resource_create.rb#L126-L133
2,890
platanus/dialers
lib/dialers/transformable.rb
Dialers.Transformable.transform_to_one
def transform_to_one(entity_class_or_decider, root: nil) object = root ? raw_data[root] : raw_data transform_attributes_to_object(entity_class_or_decider, object) end
ruby
def transform_to_one(entity_class_or_decider, root: nil) object = root ? raw_data[root] : raw_data transform_attributes_to_object(entity_class_or_decider, object) end
[ "def", "transform_to_one", "(", "entity_class_or_decider", ",", "root", ":", "nil", ")", "object", "=", "root", "?", "raw_data", "[", "root", "]", ":", "raw_data", "transform_attributes_to_object", "(", "entity_class_or_decider", ",", "object", ")", "end" ]
Transforms a response into one object based on the response's body. If you pass a hash like this: { 200 => ProductCreated, 202 => ProductAccepted } the transformation will decide which object to create based on the status. It's important to note that the class must provide attribute writers for this method to...
[ "Transforms", "a", "response", "into", "one", "object", "based", "on", "the", "response", "s", "body", "." ]
8fd8750c367ec0d058d2adfe25915125d95cb890
https://github.com/platanus/dialers/blob/8fd8750c367ec0d058d2adfe25915125d95cb890/lib/dialers/transformable.rb#L28-L31
2,891
platanus/dialers
lib/dialers/transformable.rb
Dialers.Transformable.transform_to_many
def transform_to_many(entity_class_or_decider, root: nil) items = get_rooted_items(root) unless items.is_a?(Array) fail Dialers::ImpossibleTranformationError.new(response) end items.map { |item| transform_attributes_to_object(entity_class_or_decider, item) } end
ruby
def transform_to_many(entity_class_or_decider, root: nil) items = get_rooted_items(root) unless items.is_a?(Array) fail Dialers::ImpossibleTranformationError.new(response) end items.map { |item| transform_attributes_to_object(entity_class_or_decider, item) } end
[ "def", "transform_to_many", "(", "entity_class_or_decider", ",", "root", ":", "nil", ")", "items", "=", "get_rooted_items", "(", "root", ")", "unless", "items", ".", "is_a?", "(", "Array", ")", "fail", "Dialers", "::", "ImpossibleTranformationError", ".", "new",...
Transforms a response into many objects based on the response's body. @param entity_class_or_decider [Hash, Class] A class or a hash of Fixnum => Class to decide with the status. @param root [String, nil] The root to use to get an array from the body. @return [Array<Object>] The result of the transformation.
[ "Transforms", "a", "response", "into", "many", "objects", "based", "on", "the", "response", "s", "body", "." ]
8fd8750c367ec0d058d2adfe25915125d95cb890
https://github.com/platanus/dialers/blob/8fd8750c367ec0d058d2adfe25915125d95cb890/lib/dialers/transformable.rb#L40-L46
2,892
taganaka/polipus
lib/polipus.rb
Polipus.PolipusCrawler.add_url
def add_url(url, params = {}) page = Page.new(url, params) yield(page) if block_given? internal_queue << page.to_json end
ruby
def add_url(url, params = {}) page = Page.new(url, params) yield(page) if block_given? internal_queue << page.to_json end
[ "def", "add_url", "(", "url", ",", "params", "=", "{", "}", ")", "page", "=", "Page", ".", "new", "(", "url", ",", "params", ")", "yield", "(", "page", ")", "if", "block_given?", "internal_queue", "<<", "page", ".", "to_json", "end" ]
Enqueue an url, no matter what
[ "Enqueue", "an", "url", "no", "matter", "what" ]
8917a37c151a8e36fcc49fb5461aaeaf97f1f5a6
https://github.com/taganaka/polipus/blob/8917a37c151a8e36fcc49fb5461aaeaf97f1f5a6/lib/polipus.rb#L359-L363
2,893
taganaka/polipus
lib/polipus.rb
Polipus.PolipusCrawler.should_be_visited?
def should_be_visited?(url, with_tracker = true) case # robots.txt when !allowed_by_robot?(url) false # Check against whitelist pattern matching when !@follow_links_like.empty? && @follow_links_like.none? { |p| url.path =~ p } false # Check against blacklist pattern m...
ruby
def should_be_visited?(url, with_tracker = true) case # robots.txt when !allowed_by_robot?(url) false # Check against whitelist pattern matching when !@follow_links_like.empty? && @follow_links_like.none? { |p| url.path =~ p } false # Check against blacklist pattern m...
[ "def", "should_be_visited?", "(", "url", ",", "with_tracker", "=", "true", ")", "case", "# robots.txt", "when", "!", "allowed_by_robot?", "(", "url", ")", "false", "# Check against whitelist pattern matching", "when", "!", "@follow_links_like", ".", "empty?", "&&", ...
URLs enqueue policy
[ "URLs", "enqueue", "policy" ]
8917a37c151a8e36fcc49fb5461aaeaf97f1f5a6
https://github.com/taganaka/polipus/blob/8917a37c151a8e36fcc49fb5461aaeaf97f1f5a6/lib/polipus.rb#L375-L395
2,894
taganaka/polipus
lib/polipus.rb
Polipus.PolipusCrawler.links_for
def links_for(page) page.domain_aliases = domain_aliases @focus_crawl_block.nil? ? page.links : @focus_crawl_block.call(page) end
ruby
def links_for(page) page.domain_aliases = domain_aliases @focus_crawl_block.nil? ? page.links : @focus_crawl_block.call(page) end
[ "def", "links_for", "(", "page", ")", "page", ".", "domain_aliases", "=", "domain_aliases", "@focus_crawl_block", ".", "nil?", "?", "page", ".", "links", ":", "@focus_crawl_block", ".", "call", "(", "page", ")", "end" ]
It extracts URLs from the page
[ "It", "extracts", "URLs", "from", "the", "page" ]
8917a37c151a8e36fcc49fb5461aaeaf97f1f5a6
https://github.com/taganaka/polipus/blob/8917a37c151a8e36fcc49fb5461aaeaf97f1f5a6/lib/polipus.rb#L398-L401
2,895
taganaka/polipus
lib/polipus.rb
Polipus.PolipusCrawler.page_expired?
def page_expired?(page) return false if @options[:ttl_page].nil? stored_page = @storage.get(page) r = stored_page && stored_page.expired?(@options[:ttl_page]) @logger.debug { "Page #{page.url} marked as expired" } if r r end
ruby
def page_expired?(page) return false if @options[:ttl_page].nil? stored_page = @storage.get(page) r = stored_page && stored_page.expired?(@options[:ttl_page]) @logger.debug { "Page #{page.url} marked as expired" } if r r end
[ "def", "page_expired?", "(", "page", ")", "return", "false", "if", "@options", "[", ":ttl_page", "]", ".", "nil?", "stored_page", "=", "@storage", ".", "get", "(", "page", ")", "r", "=", "stored_page", "&&", "stored_page", ".", "expired?", "(", "@options",...
whether a page is expired or not
[ "whether", "a", "page", "is", "expired", "or", "not" ]
8917a37c151a8e36fcc49fb5461aaeaf97f1f5a6
https://github.com/taganaka/polipus/blob/8917a37c151a8e36fcc49fb5461aaeaf97f1f5a6/lib/polipus.rb#L404-L410
2,896
taganaka/polipus
lib/polipus.rb
Polipus.PolipusCrawler.page_exists?
def page_exists?(page) return false if page.user_data && page.user_data.p_seeded @storage.exists?(page) && !page_expired?(page) end
ruby
def page_exists?(page) return false if page.user_data && page.user_data.p_seeded @storage.exists?(page) && !page_expired?(page) end
[ "def", "page_exists?", "(", "page", ")", "return", "false", "if", "page", ".", "user_data", "&&", "page", ".", "user_data", ".", "p_seeded", "@storage", ".", "exists?", "(", "page", ")", "&&", "!", "page_expired?", "(", "page", ")", "end" ]
whether a page exists or not
[ "whether", "a", "page", "exists", "or", "not" ]
8917a37c151a8e36fcc49fb5461aaeaf97f1f5a6
https://github.com/taganaka/polipus/blob/8917a37c151a8e36fcc49fb5461aaeaf97f1f5a6/lib/polipus.rb#L413-L416
2,897
taganaka/polipus
lib/polipus.rb
Polipus.PolipusCrawler.enqueue
def enqueue(url_to_visit, current_page) page_to_visit = Page.new(url_to_visit.to_s, referer: current_page.url.to_s, depth: current_page.depth + 1) internal_queue << page_to_visit.to_json to_track = @options[:include_query_string_in_saved_page] ? url_to_visit.to_s : url_to_visit.to_s.gsub(/\?.*$/, '') ...
ruby
def enqueue(url_to_visit, current_page) page_to_visit = Page.new(url_to_visit.to_s, referer: current_page.url.to_s, depth: current_page.depth + 1) internal_queue << page_to_visit.to_json to_track = @options[:include_query_string_in_saved_page] ? url_to_visit.to_s : url_to_visit.to_s.gsub(/\?.*$/, '') ...
[ "def", "enqueue", "(", "url_to_visit", ",", "current_page", ")", "page_to_visit", "=", "Page", ".", "new", "(", "url_to_visit", ".", "to_s", ",", "referer", ":", "current_page", ".", "url", ".", "to_s", ",", "depth", ":", "current_page", ".", "depth", "+",...
The url is enqueued for a later visit
[ "The", "url", "is", "enqueued", "for", "a", "later", "visit" ]
8917a37c151a8e36fcc49fb5461aaeaf97f1f5a6
https://github.com/taganaka/polipus/blob/8917a37c151a8e36fcc49fb5461aaeaf97f1f5a6/lib/polipus.rb#L429-L435
2,898
taganaka/polipus
lib/polipus.rb
Polipus.PolipusCrawler.execute_plugin
def execute_plugin(method) Polipus::Plugin.plugins.each do |k, p| next unless p.respond_to?(method) @logger.info { "Running plugin method #{method} on #{k}" } ret_val = p.send(method, self) instance_eval(&ret_val) if ret_val.is_a? Proc end end
ruby
def execute_plugin(method) Polipus::Plugin.plugins.each do |k, p| next unless p.respond_to?(method) @logger.info { "Running plugin method #{method} on #{k}" } ret_val = p.send(method, self) instance_eval(&ret_val) if ret_val.is_a? Proc end end
[ "def", "execute_plugin", "(", "method", ")", "Polipus", "::", "Plugin", ".", "plugins", ".", "each", "do", "|", "k", ",", "p", "|", "next", "unless", "p", ".", "respond_to?", "(", "method", ")", "@logger", ".", "info", "{", "\"Running plugin method #{metho...
It invokes a plugin method if any
[ "It", "invokes", "a", "plugin", "method", "if", "any" ]
8917a37c151a8e36fcc49fb5461aaeaf97f1f5a6
https://github.com/taganaka/polipus/blob/8917a37c151a8e36fcc49fb5461aaeaf97f1f5a6/lib/polipus.rb#L478-L485
2,899
mateomurphy/rails_locale_detection
lib/rails_locale_detection/detection_methods.rb
RailsLocaleDetection.DetectionMethods.set_default_url_option_for_request?
def set_default_url_option_for_request? RailsLocaleDetection.set_default_url_option === true || RailsLocaleDetection.set_default_url_option == :always || RailsLocaleDetection.set_default_url_option == :explicitly && params[locale_key].present? end
ruby
def set_default_url_option_for_request? RailsLocaleDetection.set_default_url_option === true || RailsLocaleDetection.set_default_url_option == :always || RailsLocaleDetection.set_default_url_option == :explicitly && params[locale_key].present? end
[ "def", "set_default_url_option_for_request?", "RailsLocaleDetection", ".", "set_default_url_option", "===", "true", "||", "RailsLocaleDetection", ".", "set_default_url_option", "==", ":always", "||", "RailsLocaleDetection", ".", "set_default_url_option", "==", ":explicitly", "&...
returns true if the default url option should be set for this request
[ "returns", "true", "if", "the", "default", "url", "option", "should", "be", "set", "for", "this", "request" ]
0c7748db7374196ca0b5f6aa12aea339671fe704
https://github.com/mateomurphy/rails_locale_detection/blob/0c7748db7374196ca0b5f6aa12aea339671fe704/lib/rails_locale_detection/detection_methods.rb#L50-L52