repo
stringlengths
5
67
path
stringlengths
4
218
func_name
stringlengths
0
151
original_string
stringlengths
52
373k
language
stringclasses
6 values
code
stringlengths
52
373k
code_tokens
listlengths
10
512
docstring
stringlengths
3
47.2k
docstring_tokens
listlengths
3
234
sha
stringlengths
40
40
url
stringlengths
85
339
partition
stringclasses
3 values
obrie/turntabler
lib/turntabler/client.rb
Turntabler.Client.on_session_ended
def on_session_ended url = @connection.url room = @room @connection = nil @room = nil # Automatically reconnect to the room / server if allowed if @reconnect reconnect_from(Exception) do room ? room.enter : connect(url) trigger(:reconnected) end ...
ruby
def on_session_ended url = @connection.url room = @room @connection = nil @room = nil # Automatically reconnect to the room / server if allowed if @reconnect reconnect_from(Exception) do room ? room.enter : connect(url) trigger(:reconnected) end ...
[ "def", "on_session_ended", "url", "=", "@connection", ".", "url", "room", "=", "@room", "@connection", "=", "nil", "@room", "=", "nil", "if", "@reconnect", "reconnect_from", "(", "Exception", ")", "do", "room", "?", "room", ".", "enter", ":", "connect", "(...
Callback when the session has ended. This will automatically reconnect if allowed to do so.
[ "Callback", "when", "the", "session", "has", "ended", ".", "This", "will", "automatically", "reconnect", "if", "allowed", "to", "do", "so", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/client.rb#L610-L623
valid
obrie/turntabler
lib/turntabler/client.rb
Turntabler.Client.reconnect_from
def reconnect_from(*exceptions) begin yield rescue *exceptions => ex if @reconnect logger.debug "Connection failed: #{ex.message}" EM::Synchrony.sleep(@reconnect_wait) logger.debug 'Attempting to reconnect' retry else raise en...
ruby
def reconnect_from(*exceptions) begin yield rescue *exceptions => ex if @reconnect logger.debug "Connection failed: #{ex.message}" EM::Synchrony.sleep(@reconnect_wait) logger.debug 'Attempting to reconnect' retry else raise en...
[ "def", "reconnect_from", "(", "*", "exceptions", ")", "begin", "yield", "rescue", "*", "exceptions", "=>", "ex", "if", "@reconnect", "logger", ".", "debug", "\"Connection failed: #{ex.message}\"", "EM", "::", "Synchrony", ".", "sleep", "(", "@reconnect_wait", ")",...
Runs a given block and retries that block after a certain period of time if any of the specified exceptions are raised. Note that there is no limit on the number of attempts to retry.
[ "Runs", "a", "given", "block", "and", "retries", "that", "block", "after", "a", "certain", "period", "of", "time", "if", "any", "of", "the", "specified", "exceptions", "are", "raised", ".", "Note", "that", "there", "is", "no", "limit", "on", "the", "numb...
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/client.rb#L628-L641
valid
obrie/turntabler
lib/turntabler/client.rb
Turntabler.Client.wait
def wait(&block) fiber = Fiber.current # Resume the fiber when a response is received allow_resume = true block.call do |*args| fiber.resume(*args) if allow_resume end # Attempt to pause the fiber until a response is received begin Fiber.yield rescue Fib...
ruby
def wait(&block) fiber = Fiber.current # Resume the fiber when a response is received allow_resume = true block.call do |*args| fiber.resume(*args) if allow_resume end # Attempt to pause the fiber until a response is received begin Fiber.yield rescue Fib...
[ "def", "wait", "(", "&", "block", ")", "fiber", "=", "Fiber", ".", "current", "allow_resume", "=", "true", "block", ".", "call", "do", "|", "*", "args", "|", "fiber", ".", "resume", "(", "*", "args", ")", "if", "allow_resume", "end", "begin", "Fiber"...
Pauses the current fiber until it is resumed with response data. This can only get resumed explicitly by the provided block.
[ "Pauses", "the", "current", "fiber", "until", "it", "is", "resumed", "with", "response", "data", ".", "This", "can", "only", "get", "resumed", "explicitly", "by", "the", "provided", "block", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/client.rb#L645-L661
valid
o2web/rails_admin_cms
app/presenters/viewable/page_presenter.rb
Viewable.PagePresenter.tree
def tree(root_depth: 1, sitemap: false, nav_class: 'tree') return if m.parent_at_depth(root_depth).nil? @sitemap = sitemap h.content_tag :nav, class: nav_class do h.concat render_tree_master_ul(m.parent_at_depth(root_depth)) end end
ruby
def tree(root_depth: 1, sitemap: false, nav_class: 'tree') return if m.parent_at_depth(root_depth).nil? @sitemap = sitemap h.content_tag :nav, class: nav_class do h.concat render_tree_master_ul(m.parent_at_depth(root_depth)) end end
[ "def", "tree", "(", "root_depth", ":", "1", ",", "sitemap", ":", "false", ",", "nav_class", ":", "'tree'", ")", "return", "if", "m", ".", "parent_at_depth", "(", "root_depth", ")", ".", "nil?", "@sitemap", "=", "sitemap", "h", ".", "content_tag", ":nav",...
build page tree from specified root_depth, default second level root with sitemap property to render a sitemap from top root of current page
[ "build", "page", "tree", "from", "specified", "root_depth", "default", "second", "level", "root", "with", "sitemap", "property", "to", "render", "a", "sitemap", "from", "top", "root", "of", "current", "page" ]
764197753a2beb80780a44c7f559ba2bc1bb429e
https://github.com/o2web/rails_admin_cms/blob/764197753a2beb80780a44c7f559ba2bc1bb429e/app/presenters/viewable/page_presenter.rb#L5-L11
valid
o2web/rails_admin_cms
app/presenters/viewable/page_presenter.rb
Viewable.PagePresenter.breadcrumbs
def breadcrumbs(root_depth: 0, last_page_title: nil, nav_class: 'breadcrumbs', div_class: 'scrollable') return if m.parent_at_depth(root_depth).nil? h.content_tag :nav, class: nav_class do h.concat h.content_tag(:div, breadcrumbs_ul(breadcrumbs_list(root_depth, last_page_title)), class: div_class) ...
ruby
def breadcrumbs(root_depth: 0, last_page_title: nil, nav_class: 'breadcrumbs', div_class: 'scrollable') return if m.parent_at_depth(root_depth).nil? h.content_tag :nav, class: nav_class do h.concat h.content_tag(:div, breadcrumbs_ul(breadcrumbs_list(root_depth, last_page_title)), class: div_class) ...
[ "def", "breadcrumbs", "(", "root_depth", ":", "0", ",", "last_page_title", ":", "nil", ",", "nav_class", ":", "'breadcrumbs'", ",", "div_class", ":", "'scrollable'", ")", "return", "if", "m", ".", "parent_at_depth", "(", "root_depth", ")", ".", "nil?", "h", ...
build page breadcrumbs from specified root_depth, default root
[ "build", "page", "breadcrumbs", "from", "specified", "root_depth", "default", "root" ]
764197753a2beb80780a44c7f559ba2bc1bb429e
https://github.com/o2web/rails_admin_cms/blob/764197753a2beb80780a44c7f559ba2bc1bb429e/app/presenters/viewable/page_presenter.rb#L14-L19
valid
caruby/tissue
lib/catissue/resource.rb
CaTissue.Resource.tolerant_match?
def tolerant_match?(other, attributes) attributes.all? { |pa| Resource.tolerant_value_match?(send(pa), other.send(pa)) } end
ruby
def tolerant_match?(other, attributes) attributes.all? { |pa| Resource.tolerant_value_match?(send(pa), other.send(pa)) } end
[ "def", "tolerant_match?", "(", "other", ",", "attributes", ")", "attributes", ".", "all?", "{", "|", "pa", "|", "Resource", ".", "tolerant_value_match?", "(", "send", "(", "pa", ")", ",", "other", ".", "send", "(", "pa", ")", ")", "}", "end" ]
Returns whether each of the given attribute values either equals the respective other attribute value or one of the values is nil or 'Not Specified'. @param [Resource] other the domain object to compare @param [<Symbol>] attributes the attributes to compare @return [Boolean} whether this domain object is a tolera...
[ "Returns", "whether", "each", "of", "the", "given", "attribute", "values", "either", "equals", "the", "respective", "other", "attribute", "value", "or", "one", "of", "the", "values", "is", "nil", "or", "Not", "Specified", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/resource.rb#L17-L19
valid
jonathanpike/mako
lib/mako/feed_constructor.rb
Mako.FeedConstructor.parse_and_create
def parse_and_create parsed_feed = parse_feed return false unless parsed_feed feed = create_feed(parsed_feed) create_articles(feed, parsed_feed) feed end
ruby
def parse_and_create parsed_feed = parse_feed return false unless parsed_feed feed = create_feed(parsed_feed) create_articles(feed, parsed_feed) feed end
[ "def", "parse_and_create", "parsed_feed", "=", "parse_feed", "return", "false", "unless", "parsed_feed", "feed", "=", "create_feed", "(", "parsed_feed", ")", "create_articles", "(", "feed", ",", "parsed_feed", ")", "feed", "end" ]
Parses raw XML feed and creates Feed and Article objects to be rendered. Returns false if feed cannot be parsed. @return [Feed]
[ "Parses", "raw", "XML", "feed", "and", "creates", "Feed", "and", "Article", "objects", "to", "be", "rendered", ".", "Returns", "false", "if", "feed", "cannot", "be", "parsed", "." ]
2aa3665ebf23f09727e59d667b34155755493bdf
https://github.com/jonathanpike/mako/blob/2aa3665ebf23f09727e59d667b34155755493bdf/lib/mako/feed_constructor.rb#L16-L23
valid
jonathanpike/mako
lib/mako/feed_constructor.rb
Mako.FeedConstructor.entry_summary
def entry_summary(entry) !entry.content || entry.content.empty? ? entry.summary : entry.content end
ruby
def entry_summary(entry) !entry.content || entry.content.empty? ? entry.summary : entry.content end
[ "def", "entry_summary", "(", "entry", ")", "!", "entry", ".", "content", "||", "entry", ".", "content", ".", "empty?", "?", "entry", ".", "summary", ":", "entry", ".", "content", "end" ]
Some feeds use summary for the full article body, other feeds use content. This prefers content, but falls back to summary. @param [Feedjira::Feed] @return [String] an HTML string of the source article body
[ "Some", "feeds", "use", "summary", "for", "the", "full", "article", "body", "other", "feeds", "use", "content", ".", "This", "prefers", "content", "but", "falls", "back", "to", "summary", "." ]
2aa3665ebf23f09727e59d667b34155755493bdf
https://github.com/jonathanpike/mako/blob/2aa3665ebf23f09727e59d667b34155755493bdf/lib/mako/feed_constructor.rb#L67-L69
valid
thefrontiergroup/scoped_attr_accessible
lib/scoped_attr_accessible/sanitizer.rb
ScopedAttrAccessible.Sanitizer.normalize_scope
def normalize_scope(object, context) return object if object.is_a?(Symbol) # 1. Process recognizers, looking for a match. @scope_recognizers.each_pair do |name, recognizers| return name if recognizers.any? { |r| lambda(&r).call(context, object) } end # 2. Process converters, findin...
ruby
def normalize_scope(object, context) return object if object.is_a?(Symbol) # 1. Process recognizers, looking for a match. @scope_recognizers.each_pair do |name, recognizers| return name if recognizers.any? { |r| lambda(&r).call(context, object) } end # 2. Process converters, findin...
[ "def", "normalize_scope", "(", "object", ",", "context", ")", "return", "object", "if", "object", ".", "is_a?", "(", "Symbol", ")", "@scope_recognizers", ".", "each_pair", "do", "|", "name", ",", "recognizers", "|", "return", "name", "if", "recognizers", "."...
Looks up a scope name from the registered recognizers and then from the converters.
[ "Looks", "up", "a", "scope", "name", "from", "the", "registered", "recognizers", "and", "then", "from", "the", "converters", "." ]
7f70825f8eb76be95f499045a0d27028d74f8321
https://github.com/thefrontiergroup/scoped_attr_accessible/blob/7f70825f8eb76be95f499045a0d27028d74f8321/lib/scoped_attr_accessible/sanitizer.rb#L16-L29
valid
obrie/turntabler
lib/turntabler/playlist_directory.rb
Turntabler.PlaylistDirectory.build
def build(attrs) playlist = Playlist.new(client, attrs) # Update existing in cache or cache a new playlist if existing = @playlists[playlist.id] playlist = existing playlist.attributes = attrs else @playlists[playlist.id] = playlist end playlist end
ruby
def build(attrs) playlist = Playlist.new(client, attrs) # Update existing in cache or cache a new playlist if existing = @playlists[playlist.id] playlist = existing playlist.attributes = attrs else @playlists[playlist.id] = playlist end playlist end
[ "def", "build", "(", "attrs", ")", "playlist", "=", "Playlist", ".", "new", "(", "client", ",", "attrs", ")", "if", "existing", "=", "@playlists", "[", "playlist", ".", "id", "]", "playlist", "=", "existing", "playlist", ".", "attributes", "=", "attrs", ...
Gets the playlist represented by the given attributes. If the playlist hasn't been previously accessed, then a new Playlist instance will get created. @api private @param [Hash] attrs The attributes representing the playlist @return [Turntabler::Playlist]
[ "Gets", "the", "playlist", "represented", "by", "the", "given", "attributes", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/playlist_directory.rb#L47-L59
valid
weibel/MapKitWrapper
lib/map-kit-wrapper/zoom_level.rb
MapKit.ZoomLevel.set_center_coordinates
def set_center_coordinates(center_coordinate, zoom_level, animated = false) # clamp large numbers to 18 zoom_level = [zoom_level, 18].min # use the zoom level to compute the region span = self.class.coordinate_span_with_map_view(self, center_coordinate, zoom_level) region = CoordinateRegi...
ruby
def set_center_coordinates(center_coordinate, zoom_level, animated = false) # clamp large numbers to 18 zoom_level = [zoom_level, 18].min # use the zoom level to compute the region span = self.class.coordinate_span_with_map_view(self, center_coordinate, zoom_level) region = CoordinateRegi...
[ "def", "set_center_coordinates", "(", "center_coordinate", ",", "zoom_level", ",", "animated", "=", "false", ")", "zoom_level", "=", "[", "zoom_level", ",", "18", "]", ".", "min", "span", "=", "self", ".", "class", ".", "coordinate_span_with_map_view", "(", "s...
Set the views center coordinates with a given zoom level * *Args* : - +center_coordinate+ -> A MKMapPoint - +zoom_level+ -> Zoom level as Int - +animated+ -> bool
[ "Set", "the", "views", "center", "coordinates", "with", "a", "given", "zoom", "level" ]
6ad3579b77e4d9be1c23ebab6a624a7dbc4ed2e6
https://github.com/weibel/MapKitWrapper/blob/6ad3579b77e4d9be1c23ebab6a624a7dbc4ed2e6/lib/map-kit-wrapper/zoom_level.rb#L121-L131
valid
weibel/MapKitWrapper
lib/map-kit-wrapper/zoom_level.rb
MapKit.ZoomLevel.set_map_lat_lon
def set_map_lat_lon(latitude, longitude, zoom_level, animated = false) coordinate = LocationCoordinate.new(latitude, longitude) set_center_coordinates(coordinate, zoom_level, animated) end
ruby
def set_map_lat_lon(latitude, longitude, zoom_level, animated = false) coordinate = LocationCoordinate.new(latitude, longitude) set_center_coordinates(coordinate, zoom_level, animated) end
[ "def", "set_map_lat_lon", "(", "latitude", ",", "longitude", ",", "zoom_level", ",", "animated", "=", "false", ")", "coordinate", "=", "LocationCoordinate", ".", "new", "(", "latitude", ",", "longitude", ")", "set_center_coordinates", "(", "coordinate", ",", "zo...
Set the views latitude and longitude with a given zoom level * *Args* : - +latitude+ -> Float - +longitude+ -> Float - +zoom_level+ -> Zoom level as Int - +animated+ -> bool
[ "Set", "the", "views", "latitude", "and", "longitude", "with", "a", "given", "zoom", "level" ]
6ad3579b77e4d9be1c23ebab6a624a7dbc4ed2e6
https://github.com/weibel/MapKitWrapper/blob/6ad3579b77e4d9be1c23ebab6a624a7dbc4ed2e6/lib/map-kit-wrapper/zoom_level.rb#L142-L145
valid
weibel/MapKitWrapper
lib/map-kit-wrapper/zoom_level.rb
MapKit.ZoomLevel.zoom_level
def zoom_level region = self.region center_pixel = region.center.to_pixel_space top_left_pixel = (region.center - (region.span / 2)).to_pixel_space scaled_map_width = (center_pixel.x - top_left_pixel.x) * 2 map_size_in_pixels = MapSize.new(self.bounds.size) zoom_scale = scaled_map_...
ruby
def zoom_level region = self.region center_pixel = region.center.to_pixel_space top_left_pixel = (region.center - (region.span / 2)).to_pixel_space scaled_map_width = (center_pixel.x - top_left_pixel.x) * 2 map_size_in_pixels = MapSize.new(self.bounds.size) zoom_scale = scaled_map_...
[ "def", "zoom_level", "region", "=", "self", ".", "region", "center_pixel", "=", "region", ".", "center", ".", "to_pixel_space", "top_left_pixel", "=", "(", "region", ".", "center", "-", "(", "region", ".", "span", "/", "2", ")", ")", ".", "to_pixel_space",...
Get the current zoom level * *Returns* : - Zoom level as a Float
[ "Get", "the", "current", "zoom", "level" ]
6ad3579b77e4d9be1c23ebab6a624a7dbc4ed2e6
https://github.com/weibel/MapKitWrapper/blob/6ad3579b77e4d9be1c23ebab6a624a7dbc4ed2e6/lib/map-kit-wrapper/zoom_level.rb#L153-L164
valid
caruby/tissue
lib/catissue/domain/transfer_event_parameters.rb
CaTissue.TransferEventParameters.from=
def from=(location) if location then self.from_container = location.container self.from_row = location.row self.from_column = location.column end location end
ruby
def from=(location) if location then self.from_container = location.container self.from_row = location.row self.from_column = location.column end location end
[ "def", "from", "=", "(", "location", ")", "if", "location", "then", "self", ".", "from_container", "=", "location", ".", "container", "self", ".", "from_row", "=", "location", ".", "row", "self", ".", "from_column", "=", "location", ".", "column", "end", ...
Sets the from Location.
[ "Sets", "the", "from", "Location", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/domain/transfer_event_parameters.rb#L22-L29
valid
caruby/tissue
lib/catissue/domain/transfer_event_parameters.rb
CaTissue.TransferEventParameters.to=
def to=(location) if location.nil? then raise ArgumentError.new("Specimen cannot be moved to an empty location") end self.to_container = location.container self.to_row = location.row self.to_column = location.column end
ruby
def to=(location) if location.nil? then raise ArgumentError.new("Specimen cannot be moved to an empty location") end self.to_container = location.container self.to_row = location.row self.to_column = location.column end
[ "def", "to", "=", "(", "location", ")", "if", "location", ".", "nil?", "then", "raise", "ArgumentError", ".", "new", "(", "\"Specimen cannot be moved to an empty location\"", ")", "end", "self", ".", "to_container", "=", "location", ".", "container", "self", "."...
Sets the to Location.
[ "Sets", "the", "to", "Location", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/domain/transfer_event_parameters.rb#L39-L44
valid
fastpeek/steamd
lib/steamd/cli_options.rb
Steamd.CliOptions.input
def input o = if @input.nil? Steamd.language_dir else @input end raise 'input must be a directory' unless File.directory?(o) File.expand_path(o) end
ruby
def input o = if @input.nil? Steamd.language_dir else @input end raise 'input must be a directory' unless File.directory?(o) File.expand_path(o) end
[ "def", "input", "o", "=", "if", "@input", ".", "nil?", "Steamd", ".", "language_dir", "else", "@input", "end", "raise", "'input must be a directory'", "unless", "File", ".", "directory?", "(", "o", ")", "File", ".", "expand_path", "(", "o", ")", "end" ]
Create a CliOptions object @example Using CliOptions opts = CliOptions.new(ouput: './') @param opts [Hash] options hash @option opts [String] :output the output directory @option opts [String] :input the output directory Returns the absolute path of the input directory specified by the cli. Throws an excep...
[ "Create", "a", "CliOptions", "object" ]
8e66e78369ec735223995ea31a125b73541dfa3e
https://github.com/fastpeek/steamd/blob/8e66e78369ec735223995ea31a125b73541dfa3e/lib/steamd/cli_options.rb#L28-L37
valid
fastpeek/steamd
lib/steamd/cli_options.rb
Steamd.CliOptions.output
def output o = if @output.nil? './lib/steamd' else @output end raise 'output must be a directory' unless File.directory?(o) File.expand_path(o) end
ruby
def output o = if @output.nil? './lib/steamd' else @output end raise 'output must be a directory' unless File.directory?(o) File.expand_path(o) end
[ "def", "output", "o", "=", "if", "@output", ".", "nil?", "'./lib/steamd'", "else", "@output", "end", "raise", "'output must be a directory'", "unless", "File", ".", "directory?", "(", "o", ")", "File", ".", "expand_path", "(", "o", ")", "end" ]
Returns the absolute path of the output directory specified by the cli. Throws an exception if the output is not a directory @example Getting the output path opts = CliOptions.new(output: '/some/dir') opts.output # => '/some/dir'
[ "Returns", "the", "absolute", "path", "of", "the", "output", "directory", "specified", "by", "the", "cli", "." ]
8e66e78369ec735223995ea31a125b73541dfa3e
https://github.com/fastpeek/steamd/blob/8e66e78369ec735223995ea31a125b73541dfa3e/lib/steamd/cli_options.rb#L47-L56
valid
danijoo/Sightstone
lib/sightstone/modules/game_module.rb
Sightstone.GameModule.recent
def recent(summoner, optional={}) region = optional[:region] || @sightstone.region id = if summoner.is_a? Summoner summoner.id else summoner end uri = "https://prod.api.pvp.net/api/lol/#{region}/v1.3/game/by-summoner/#{id}/recent" response = _get_api_response(uri) _parse_response(r...
ruby
def recent(summoner, optional={}) region = optional[:region] || @sightstone.region id = if summoner.is_a? Summoner summoner.id else summoner end uri = "https://prod.api.pvp.net/api/lol/#{region}/v1.3/game/by-summoner/#{id}/recent" response = _get_api_response(uri) _parse_response(r...
[ "def", "recent", "(", "summoner", ",", "optional", "=", "{", "}", ")", "region", "=", "optional", "[", ":region", "]", "||", "@sightstone", ".", "region", "id", "=", "if", "summoner", ".", "is_a?", "Summoner", "summoner", ".", "id", "else", "summoner", ...
returns the match history of a summoner @param [Summoner, Fixnum] summoner summoner object or id of a summoner @param optional [Hash] optional arguments: :region => replaces default region @return [MatchHistory] match history of the summoner
[ "returns", "the", "match", "history", "of", "a", "summoner" ]
4c6709916ce7552f622de1a120c021e067601b4d
https://github.com/danijoo/Sightstone/blob/4c6709916ce7552f622de1a120c021e067601b4d/lib/sightstone/modules/game_module.rb#L16-L35
valid
knuedge/cratus
lib/cratus/user.rb
Cratus.User.disable
def disable if enabled? Cratus::LDAP.replace_attribute( dn, Cratus.config.user_account_control_attribute, ['514'] ) refresh else true end end
ruby
def disable if enabled? Cratus::LDAP.replace_attribute( dn, Cratus.config.user_account_control_attribute, ['514'] ) refresh else true end end
[ "def", "disable", "if", "enabled?", "Cratus", "::", "LDAP", ".", "replace_attribute", "(", "dn", ",", "Cratus", ".", "config", ".", "user_account_control_attribute", ",", "[", "'514'", "]", ")", "refresh", "else", "true", "end", "end" ]
Disables an enabled user
[ "Disables", "an", "enabled", "user" ]
a58465314a957db258f2c6bbda115c4be8ad0d83
https://github.com/knuedge/cratus/blob/a58465314a957db258f2c6bbda115c4be8ad0d83/lib/cratus/user.rb#L32-L43
valid
knuedge/cratus
lib/cratus/user.rb
Cratus.User.enable
def enable if disabled? Cratus::LDAP.replace_attribute( dn, Cratus.config.user_account_control_attribute, ['512'] ) refresh else true end end
ruby
def enable if disabled? Cratus::LDAP.replace_attribute( dn, Cratus.config.user_account_control_attribute, ['512'] ) refresh else true end end
[ "def", "enable", "if", "disabled?", "Cratus", "::", "LDAP", ".", "replace_attribute", "(", "dn", ",", "Cratus", ".", "config", ".", "user_account_control_attribute", ",", "[", "'512'", "]", ")", "refresh", "else", "true", "end", "end" ]
Enables a disabled user
[ "Enables", "a", "disabled", "user" ]
a58465314a957db258f2c6bbda115c4be8ad0d83
https://github.com/knuedge/cratus/blob/a58465314a957db258f2c6bbda115c4be8ad0d83/lib/cratus/user.rb#L59-L70
valid
knuedge/cratus
lib/cratus/user.rb
Cratus.User.unlock
def unlock if locked? && enabled? Cratus::LDAP.replace_attribute( dn, Cratus.config.user_lockout_attribute, ['0'] ) refresh elsif disabled? false else true end end
ruby
def unlock if locked? && enabled? Cratus::LDAP.replace_attribute( dn, Cratus.config.user_lockout_attribute, ['0'] ) refresh elsif disabled? false else true end end
[ "def", "unlock", "if", "locked?", "&&", "enabled?", "Cratus", "::", "LDAP", ".", "replace_attribute", "(", "dn", ",", "Cratus", ".", "config", ".", "user_lockout_attribute", ",", "[", "'0'", "]", ")", "refresh", "elsif", "disabled?", "false", "else", "true",...
Unlocks a user @return `true` on success (or if user is already unlocked) @return `false` when the account is disabled (unlocking not permitted)
[ "Unlocks", "a", "user" ]
a58465314a957db258f2c6bbda115c4be8ad0d83
https://github.com/knuedge/cratus/blob/a58465314a957db258f2c6bbda115c4be8ad0d83/lib/cratus/user.rb#L138-L151
valid
caruby/tissue
lib/catissue/domain/specimen_position.rb
CaTissue.SpecimenPosition.saver_proxy
def saver_proxy # Look for a transfer event that matches the position. xfr = specimen.event_parameters.detect do |sep| CaTissue::TransferEventParameters === sep and sep.to == location end # Create a new transfer event, if necessary. xfr ||= CaTissue::TransferEventParameters.new(:sp...
ruby
def saver_proxy # Look for a transfer event that matches the position. xfr = specimen.event_parameters.detect do |sep| CaTissue::TransferEventParameters === sep and sep.to == location end # Create a new transfer event, if necessary. xfr ||= CaTissue::TransferEventParameters.new(:sp...
[ "def", "saver_proxy", "xfr", "=", "specimen", ".", "event_parameters", ".", "detect", "do", "|", "sep", "|", "CaTissue", "::", "TransferEventParameters", "===", "sep", "and", "sep", ".", "to", "==", "location", "end", "xfr", "||=", "CaTissue", "::", "Transfe...
Returns a TransferEventParameters which serves as a proxy for saving this SpecimenPosition. @quirk caTissue caTissue does not allow saving a SpecimenPosition directly in the database. Creating a TransferEventParameters sets the SpecimenPosition as a side-effect. Therefore, SpecimenPosition save is accomplished ...
[ "Returns", "a", "TransferEventParameters", "which", "serves", "as", "a", "proxy", "for", "saving", "this", "SpecimenPosition", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/domain/specimen_position.rb#L22-L36
valid
fastpeek/steamd
lib/steamd/code_generator.rb
Steamd.CodeGenerator.generate
def generate make_output_directory files.each do |file| File.write("#{@output}/#{File.basename(file, '.*')}.rb", Steamd::Generator::Ruby.new(file).run) end end
ruby
def generate make_output_directory files.each do |file| File.write("#{@output}/#{File.basename(file, '.*')}.rb", Steamd::Generator::Ruby.new(file).run) end end
[ "def", "generate", "make_output_directory", "files", ".", "each", "do", "|", "file", "|", "File", ".", "write", "(", "\"#{@output}/#{File.basename(file, '.*')}.rb\"", ",", "Steamd", "::", "Generator", "::", "Ruby", ".", "new", "(", "file", ")", ".", "run", ")"...
Generates ruby code from the input, places the Ruby files in the output
[ "Generates", "ruby", "code", "from", "the", "input", "places", "the", "Ruby", "files", "in", "the", "output" ]
8e66e78369ec735223995ea31a125b73541dfa3e
https://github.com/fastpeek/steamd/blob/8e66e78369ec735223995ea31a125b73541dfa3e/lib/steamd/code_generator.rb#L18-L25
valid
PRX/yahoo_content_analysis
lib/yahoo_content_analysis/configuration.rb
YahooContentAnalysis.Configuration.reset!
def reset! self.api_key = DEFAULT_API_KEY self.api_secret = DEFAULT_API_SECRET self.adapter = DEFAULT_ADAPTER self.endpoint = DEFAULT_ENDPOINT self.user_agent = DEFAULT_USER_AGENT self.format = DEFAULT_FORMAT self.max ...
ruby
def reset! self.api_key = DEFAULT_API_KEY self.api_secret = DEFAULT_API_SECRET self.adapter = DEFAULT_ADAPTER self.endpoint = DEFAULT_ENDPOINT self.user_agent = DEFAULT_USER_AGENT self.format = DEFAULT_FORMAT self.max ...
[ "def", "reset!", "self", ".", "api_key", "=", "DEFAULT_API_KEY", "self", ".", "api_secret", "=", "DEFAULT_API_SECRET", "self", ".", "adapter", "=", "DEFAULT_ADAPTER", "self", ".", "endpoint", "=", "DEFAULT_ENDPOINT", "self", ".", "user_agent", "=", "DEFAULT_USER_A...
Reset configuration options to their defaults
[ "Reset", "configuration", "options", "to", "their", "defaults" ]
542caeecd693f6529f2bddb7abe980b4f7b476cf
https://github.com/PRX/yahoo_content_analysis/blob/542caeecd693f6529f2bddb7abe980b4f7b476cf/lib/yahoo_content_analysis/configuration.rb#L87-L100
valid
sugaryourcoffee/syc-svpro
lib/sycsvpro/merger.rb
Sycsvpro.Merger.execute
def execute File.open(outfile, 'w') do |out| out.puts "#{';' unless @key.empty?}#{header_cols.join(';')}" files.each do |file| @current_key = create_current_key @current_source_header = @source_header.shift processed_header = false File.open(file).each_with_...
ruby
def execute File.open(outfile, 'w') do |out| out.puts "#{';' unless @key.empty?}#{header_cols.join(';')}" files.each do |file| @current_key = create_current_key @current_source_header = @source_header.shift processed_header = false File.open(file).each_with_...
[ "def", "execute", "File", ".", "open", "(", "outfile", ",", "'w'", ")", "do", "|", "out", "|", "out", ".", "puts", "\"#{';' unless @key.empty?}#{header_cols.join(';')}\"", "files", ".", "each", "do", "|", "file", "|", "@current_key", "=", "create_current_key", ...
Merge files based on common header columns :call-seq: Sycsvpro::Merger.new(outfile: "out.csv", files: "file1.csv,file2.csv,filen.csv", header: "2010,2011,2012,2013,2014", source_header: "(\\d{4}/),(/\\d{4}/)", ...
[ "Merge", "files", "based", "on", "common", "header", "columns" ]
a8f8b97283ee593b4e8d5092da46a1b0e39fc8e3
https://github.com/sugaryourcoffee/syc-svpro/blob/a8f8b97283ee593b4e8d5092da46a1b0e39fc8e3/lib/sycsvpro/merger.rb#L86-L106
valid
sugaryourcoffee/syc-svpro
lib/sycsvpro/merger.rb
Sycsvpro.Merger.create_file_header
def create_file_header(columns) columns.each_with_index do |c,i| next if i == @current_key columns[i] = c.scan(Regexp.new(@current_source_header)).flatten[0] end @file_header = @current_key ? [@current_key.to_i] : [] header_cols.each do |h| @file_header <<...
ruby
def create_file_header(columns) columns.each_with_index do |c,i| next if i == @current_key columns[i] = c.scan(Regexp.new(@current_source_header)).flatten[0] end @file_header = @current_key ? [@current_key.to_i] : [] header_cols.each do |h| @file_header <<...
[ "def", "create_file_header", "(", "columns", ")", "columns", ".", "each_with_index", "do", "|", "c", ",", "i", "|", "next", "if", "i", "==", "@current_key", "columns", "[", "i", "]", "=", "c", ".", "scan", "(", "Regexp", ".", "new", "(", "@current_sour...
create a filter for the columns that match the header filter
[ "create", "a", "filter", "for", "the", "columns", "that", "match", "the", "header", "filter" ]
a8f8b97283ee593b4e8d5092da46a1b0e39fc8e3
https://github.com/sugaryourcoffee/syc-svpro/blob/a8f8b97283ee593b4e8d5092da46a1b0e39fc8e3/lib/sycsvpro/merger.rb#L111-L124
valid
caruby/tissue
lib/catissue/domain/consent_tier_status.rb
CaTissue.ConsentTierStatus.statement_match?
def statement_match?(other) ct = consent_tier oct = other.consent_tier ct.nil? or oct.nil? or ct.identifier == oct.identifier or ct.statement == oct.statement end
ruby
def statement_match?(other) ct = consent_tier oct = other.consent_tier ct.nil? or oct.nil? or ct.identifier == oct.identifier or ct.statement == oct.statement end
[ "def", "statement_match?", "(", "other", ")", "ct", "=", "consent_tier", "oct", "=", "other", ".", "consent_tier", "ct", ".", "nil?", "or", "oct", ".", "nil?", "or", "ct", ".", "identifier", "==", "oct", ".", "identifier", "or", "ct", ".", "statement", ...
Returns true if this ConsentTierStatus ConsentTier is nil, the other ConsentTierStatus ConsentTier is nil, both ConsentTier identifiers are equal, or both ConsentTier statements are equal.
[ "Returns", "true", "if", "this", "ConsentTierStatus", "ConsentTier", "is", "nil", "the", "other", "ConsentTierStatus", "ConsentTier", "is", "nil", "both", "ConsentTier", "identifiers", "are", "equal", "or", "both", "ConsentTier", "statements", "are", "equal", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/domain/consent_tier_status.rb#L20-L24
valid
sugaryourcoffee/syc-svpro
lib/sycsvpro/column_filter.rb
Sycsvpro.ColumnFilter.process
def process(object, options={}) return nil if object.nil? or object.empty? object = object.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') object += " " if object =~ /;$/ return object if filter.empty? and pivot.empty? filtered = object.split(';').values_at(*filt...
ruby
def process(object, options={}) return nil if object.nil? or object.empty? object = object.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') object += " " if object =~ /;$/ return object if filter.empty? and pivot.empty? filtered = object.split(';').values_at(*filt...
[ "def", "process", "(", "object", ",", "options", "=", "{", "}", ")", "return", "nil", "if", "object", ".", "nil?", "or", "object", ".", "empty?", "object", "=", "object", ".", "encode", "(", "'UTF-8'", ",", "'binary'", ",", "invalid", ":", ":replace", ...
Processes the filter and returns the values that respect the filter
[ "Processes", "the", "filter", "and", "returns", "the", "values", "that", "respect", "the", "filter" ]
a8f8b97283ee593b4e8d5092da46a1b0e39fc8e3
https://github.com/sugaryourcoffee/syc-svpro/blob/a8f8b97283ee593b4e8d5092da46a1b0e39fc8e3/lib/sycsvpro/column_filter.rb#L10-L24
valid
caruby/tissue
lib/catissue/domain/storage_container.rb
CaTissue.StorageContainer.add
def add(storable, *coordinate) return add_local(storable, *coordinate) unless coordinate.empty? add_to_existing_container(storable) or add_to_new_subcontainer(storable) or out_of_bounds(storable) self end
ruby
def add(storable, *coordinate) return add_local(storable, *coordinate) unless coordinate.empty? add_to_existing_container(storable) or add_to_new_subcontainer(storable) or out_of_bounds(storable) self end
[ "def", "add", "(", "storable", ",", "*", "coordinate", ")", "return", "add_local", "(", "storable", ",", "*", "coordinate", ")", "unless", "coordinate", ".", "empty?", "add_to_existing_container", "(", "storable", ")", "or", "add_to_new_subcontainer", "(", "stor...
Adds the given storable to this container. If the storable has a current position, then the storable is moved from that position to this container. The new position is given by the given coordinate, if given to this method. The default coordinate is the first available slot within this Container. If this container...
[ "Adds", "the", "given", "storable", "to", "this", "container", ".", "If", "the", "storable", "has", "a", "current", "position", "then", "the", "storable", "is", "moved", "from", "that", "position", "to", "this", "container", ".", "The", "new", "position", ...
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/domain/storage_container.rb#L83-L87
valid
caruby/tissue
lib/catissue/domain/storage_container.rb
CaTissue.StorageContainer.find_subcontainer
def find_subcontainer(name, type) logger.debug { "Finding box with name #{name}..." } ctr = CaTissue::StorageContainer.new(:name => name) if ctr.find then logger.debug { "Container found: #{ctr}." } else logger.debug { "Container not found: #{name}." } create_subcontainer...
ruby
def find_subcontainer(name, type) logger.debug { "Finding box with name #{name}..." } ctr = CaTissue::StorageContainer.new(:name => name) if ctr.find then logger.debug { "Container found: #{ctr}." } else logger.debug { "Container not found: #{name}." } create_subcontainer...
[ "def", "find_subcontainer", "(", "name", ",", "type", ")", "logger", ".", "debug", "{", "\"Finding box with name #{name}...\"", "}", "ctr", "=", "CaTissue", "::", "StorageContainer", ".", "new", "(", ":name", "=>", "name", ")", "if", "ctr", ".", "find", "the...
Finds the container with the given name, or creates a new container of the given type if necessary. @param [String] the container search name @param [CaTissue::StorageContainer] the container type @return a container with the given name
[ "Finds", "the", "container", "with", "the", "given", "name", "or", "creates", "a", "new", "container", "of", "the", "given", "type", "if", "necessary", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/domain/storage_container.rb#L97-L107
valid
caruby/tissue
lib/catissue/domain/storage_container.rb
CaTissue.StorageContainer.add_to_existing_container
def add_to_existing_container(storable) if storage_type.nil? then raise Jinx::ValidationError.new("Cannot add #{storable.qp} to #{qp} with missing storage type") end # the subcontainers in column, row sort order scs = subcontainers.sort { |sc1, sc2| sc1.position.coordinate <=> sc2.positi...
ruby
def add_to_existing_container(storable) if storage_type.nil? then raise Jinx::ValidationError.new("Cannot add #{storable.qp} to #{qp} with missing storage type") end # the subcontainers in column, row sort order scs = subcontainers.sort { |sc1, sc2| sc1.position.coordinate <=> sc2.positi...
[ "def", "add_to_existing_container", "(", "storable", ")", "if", "storage_type", ".", "nil?", "then", "raise", "Jinx", "::", "ValidationError", ".", "new", "(", "\"Cannot add #{storable.qp} to #{qp} with missing storage type\"", ")", "end", "scs", "=", "subcontainers", "...
Adds the given storable to a container within this StorageContainer's hierarchy. @param @storable (see #add) @return [StorageContainer, nil] self if added, nil otherwise @raise [Jinx::ValidationError] if this container does not have a storage type, or if a circular containment reference is detected
[ "Adds", "the", "given", "storable", "to", "a", "container", "within", "this", "StorageContainer", "s", "hierarchy", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/domain/storage_container.rb#L144-L172
valid
caruby/tissue
lib/catissue/domain/storage_container.rb
CaTissue.StorageContainer.add_to_new_subcontainer
def add_to_new_subcontainer(storable) # the subcontainers in column, row sort order scs = subcontainers.sort { |sc1, sc2| sc1.position.coordinate <=> sc2.position.coordinate } logger.debug { "Looking for a #{self} subcontainer #{scs} to place a new #{storable.qp} container..." } unless scs.empty? ...
ruby
def add_to_new_subcontainer(storable) # the subcontainers in column, row sort order scs = subcontainers.sort { |sc1, sc2| sc1.position.coordinate <=> sc2.position.coordinate } logger.debug { "Looking for a #{self} subcontainer #{scs} to place a new #{storable.qp} container..." } unless scs.empty? ...
[ "def", "add_to_new_subcontainer", "(", "storable", ")", "scs", "=", "subcontainers", ".", "sort", "{", "|", "sc1", ",", "sc2", "|", "sc1", ".", "position", ".", "coordinate", "<=>", "sc2", ".", "position", ".", "coordinate", "}", "logger", ".", "debug", ...
Creates a subcontainer which holds the given storable. Creates nested subcontainers as necessary. @param @storable (see #add) @return [StorageContainer, nil] self if a subcontainer was created, nil otherwise
[ "Creates", "a", "subcontainer", "which", "holds", "the", "given", "storable", ".", "Creates", "nested", "subcontainers", "as", "necessary", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/domain/storage_container.rb#L178-L191
valid
caruby/tissue
lib/catissue/domain/storage_container.rb
CaTissue.StorageContainer.type_path_to
def type_path_to(storable) shortest = nil holds_storage_types.each do |st| stp = st.path_to(storable) || next shortest = stp if shortest.nil? or stp.size < shortest.size end shortest end
ruby
def type_path_to(storable) shortest = nil holds_storage_types.each do |st| stp = st.path_to(storable) || next shortest = stp if shortest.nil? or stp.size < shortest.size end shortest end
[ "def", "type_path_to", "(", "storable", ")", "shortest", "=", "nil", "holds_storage_types", ".", "each", "do", "|", "st", "|", "stp", "=", "st", ".", "path_to", "(", "storable", ")", "||", "next", "shortest", "=", "stp", "if", "shortest", ".", "nil?", ...
Returns a StorageType array of descendant StorageTypes which can hold the given storable, or nil if no such path exists. @param [Storable] the domain object to store in this container @return [<StorageType>] the {StorageType}s leading from this container to the storable holder
[ "Returns", "a", "StorageType", "array", "of", "descendant", "StorageTypes", "which", "can", "hold", "the", "given", "storable", "or", "nil", "if", "no", "such", "path", "exists", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/domain/storage_container.rb#L237-L244
valid
obrie/turntabler
lib/turntabler/resource.rb
Turntabler.Resource.attributes=
def attributes=(attributes) if attributes attributes.each do |attribute, value| attribute = attribute.to_s if attribute == 'metadata' self.attributes = value else __send__("#{attribute}=", value) if respond_to?("#{attribute}=", true) end ...
ruby
def attributes=(attributes) if attributes attributes.each do |attribute, value| attribute = attribute.to_s if attribute == 'metadata' self.attributes = value else __send__("#{attribute}=", value) if respond_to?("#{attribute}=", true) end ...
[ "def", "attributes", "=", "(", "attributes", ")", "if", "attributes", "attributes", ".", "each", "do", "|", "attribute", ",", "value", "|", "attribute", "=", "attribute", ".", "to_s", "if", "attribute", "==", "'metadata'", "self", ".", "attributes", "=", "...
Attempts to set attributes on the object only if they've been explicitly defined by the class. Note that this will also attempt to interpret any "metadata" properties as additional attributes. @api private @param [Hash] attributes The updated attributes for the resource
[ "Attempts", "to", "set", "attributes", "on", "the", "object", "only", "if", "they", "ve", "been", "explicitly", "defined", "by", "the", "class", ".", "Note", "that", "this", "will", "also", "attempt", "to", "interpret", "any", "metadata", "properties", "as",...
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/resource.rb#L126-L137
valid
obrie/turntabler
lib/turntabler/avatar.rb
Turntabler.Avatar.available?
def available? client.user.points >= minimum_points && (!acl || client.user.acl >= acl) end
ruby
def available? client.user.points >= minimum_points && (!acl || client.user.acl >= acl) end
[ "def", "available?", "client", ".", "user", ".", "points", ">=", "minimum_points", "&&", "(", "!", "acl", "||", "client", ".", "user", ".", "acl", ">=", "acl", ")", "end" ]
Determines whether this avatar is available to the current user. @return [Boolean] +true+ if the avatar is available, otherwise +false+
[ "Determines", "whether", "this", "avatar", "is", "available", "to", "the", "current", "user", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/avatar.rb#L17-L19
valid
obrie/turntabler
lib/turntabler/avatar.rb
Turntabler.Avatar.set
def set api('user.set_avatar', :avatarid => id) client.user.attributes = {'avatarid' => id} client.user.avatar.attributes = {'min' => minimum_points, 'acl' => acl} true end
ruby
def set api('user.set_avatar', :avatarid => id) client.user.attributes = {'avatarid' => id} client.user.avatar.attributes = {'min' => minimum_points, 'acl' => acl} true end
[ "def", "set", "api", "(", "'user.set_avatar'", ",", ":avatarid", "=>", "id", ")", "client", ".", "user", ".", "attributes", "=", "{", "'avatarid'", "=>", "id", "}", "client", ".", "user", ".", "avatar", ".", "attributes", "=", "{", "'min'", "=>", "mini...
Updates the current user's avatar to this one. @return [true] @raise [Turntabler::Error] if the command fails @example avatar.set # => true
[ "Updates", "the", "current", "user", "s", "avatar", "to", "this", "one", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/avatar.rb#L27-L32
valid
danijoo/Sightstone
lib/sightstone/modules/champion_module.rb
Sightstone.ChampionModule.champions
def champions(optional={}) region = optional[:region] || @sightstone.region free_to_play = optional[:free_to_play] || false uri = "https://prod.api.pvp.net/api/lol/#{region}/v1.1/champion" response = _get_api_response(uri, {'freeToPlay' => free_to_play}) _parse_response(response) { |resp| dat...
ruby
def champions(optional={}) region = optional[:region] || @sightstone.region free_to_play = optional[:free_to_play] || false uri = "https://prod.api.pvp.net/api/lol/#{region}/v1.1/champion" response = _get_api_response(uri, {'freeToPlay' => free_to_play}) _parse_response(response) { |resp| dat...
[ "def", "champions", "(", "optional", "=", "{", "}", ")", "region", "=", "optional", "[", ":region", "]", "||", "@sightstone", ".", "region", "free_to_play", "=", "optional", "[", ":free_to_play", "]", "||", "false", "uri", "=", "\"https://prod.api.pvp.net/api/...
call to get champions @param optional [Hash] optional arguments: :region => replaces default region, :free_to_play => boolean (only free to play champs if true) @return [Array<Champion>] array of champs
[ "call", "to", "get", "champions" ]
4c6709916ce7552f622de1a120c021e067601b4d
https://github.com/danijoo/Sightstone/blob/4c6709916ce7552f622de1a120c021e067601b4d/lib/sightstone/modules/champion_module.rb#L14-L32
valid
superp/meta_manager
lib/meta_manager/taggable.rb
MetaManager.Taggable.meta_tag
def meta_tag(attr_name, options={}) key = normalize_meta_tag_name(attr_name) cached_meta_tags[key] ||= self.meta_tags.detect {|t| t.name == key} cached_meta_tags[key] ||= self.meta_tags.build(:name => key) if options[:build] cached_meta_tags[key] end
ruby
def meta_tag(attr_name, options={}) key = normalize_meta_tag_name(attr_name) cached_meta_tags[key] ||= self.meta_tags.detect {|t| t.name == key} cached_meta_tags[key] ||= self.meta_tags.build(:name => key) if options[:build] cached_meta_tags[key] end
[ "def", "meta_tag", "(", "attr_name", ",", "options", "=", "{", "}", ")", "key", "=", "normalize_meta_tag_name", "(", "attr_name", ")", "cached_meta_tags", "[", "key", "]", "||=", "self", ".", "meta_tags", ".", "detect", "{", "|", "t", "|", "t", ".", "n...
Save meta tags records into one hash
[ "Save", "meta", "tags", "records", "into", "one", "hash" ]
bb3d131a1e07afd970db6491d5abb99fbc46e484
https://github.com/superp/meta_manager/blob/bb3d131a1e07afd970db6491d5abb99fbc46e484/lib/meta_manager/taggable.rb#L15-L21
valid
sugaryourcoffee/syc-svpro
lib/sycsvpro/mapper.rb
Sycsvpro.Mapper.init_col_filter
def init_col_filter(columns, source) if columns.nil? File.open(source, 'r').each do |line| line = unstring(line) next if line.empty? line += ' ' if line =~ /;$/ size = line.split(';').size columns = "0-#{size-1}" break ...
ruby
def init_col_filter(columns, source) if columns.nil? File.open(source, 'r').each do |line| line = unstring(line) next if line.empty? line += ' ' if line =~ /;$/ size = line.split(';').size columns = "0-#{size-1}" break ...
[ "def", "init_col_filter", "(", "columns", ",", "source", ")", "if", "columns", ".", "nil?", "File", ".", "open", "(", "source", ",", "'r'", ")", ".", "each", "do", "|", "line", "|", "line", "=", "unstring", "(", "line", ")", "next", "if", "line", "...
Initialize the col_filter that contains columns to be considered for mapping. If no columns are provided, that is being empty, a filter with all columns is returned
[ "Initialize", "the", "col_filter", "that", "contains", "columns", "to", "be", "considered", "for", "mapping", ".", "If", "no", "columns", "are", "provided", "that", "is", "being", "empty", "a", "filter", "with", "all", "columns", "is", "returned" ]
a8f8b97283ee593b4e8d5092da46a1b0e39fc8e3
https://github.com/sugaryourcoffee/syc-svpro/blob/a8f8b97283ee593b4e8d5092da46a1b0e39fc8e3/lib/sycsvpro/mapper.rb#L100-L112
valid
caruby/tissue
lib/catissue/metadata.rb
CaTissue.Metadata.add_annotation
def add_annotation(name, opts={}) # the module symbol mod_sym = name.camelize.to_sym # the module spec defaults pkg = opts[:package] ||= name.underscore svc = opts[:service] ||= name.underscore grp = opts[:group] ||= pkg pxy_nm = opts[:proxy_name] || "#{self.name.demodulize}Rec...
ruby
def add_annotation(name, opts={}) # the module symbol mod_sym = name.camelize.to_sym # the module spec defaults pkg = opts[:package] ||= name.underscore svc = opts[:service] ||= name.underscore grp = opts[:group] ||= pkg pxy_nm = opts[:proxy_name] || "#{self.name.demodulize}Rec...
[ "def", "add_annotation", "(", "name", ",", "opts", "=", "{", "}", ")", "mod_sym", "=", "name", ".", "camelize", ".", "to_sym", "pkg", "=", "opts", "[", ":package", "]", "||=", "name", ".", "underscore", "svc", "=", "opts", "[", ":service", "]", "||="...
Declares an annotation scoped by this class. @param [String] name the name of the annotation module @param [{Symbol => Object}] opts the annotation options @option opts [String] :package the package name (default is the lower-case underscore name) @option opts [String] :service the service name (default is the low...
[ "Declares", "an", "annotation", "scoped", "by", "this", "class", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/metadata.rb#L177-L190
valid
caruby/tissue
lib/catissue/metadata.rb
CaTissue.Metadata.load_local_annotations
def load_local_annotations return Array::EMPTY_ARRAY if @ann_spec_hash.nil? # an annotated class has a hook entity id initialize_annotation_holder # build the annotations @ann_spec_hash.map { |name, opts| import_annotation(name, opts) } end
ruby
def load_local_annotations return Array::EMPTY_ARRAY if @ann_spec_hash.nil? # an annotated class has a hook entity id initialize_annotation_holder # build the annotations @ann_spec_hash.map { |name, opts| import_annotation(name, opts) } end
[ "def", "load_local_annotations", "return", "Array", "::", "EMPTY_ARRAY", "if", "@ann_spec_hash", ".", "nil?", "initialize_annotation_holder", "@ann_spec_hash", ".", "map", "{", "|", "name", ",", "opts", "|", "import_annotation", "(", "name", ",", "opts", ")", "}",...
Loads this class's annotations. @return [<AnnotationModule>] the loaded annotation modules
[ "Loads", "this", "class", "s", "annotations", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/metadata.rb#L200-L206
valid
caruby/tissue
lib/catissue/metadata.rb
CaTissue.Metadata.import_annotation
def import_annotation(name, opts) logger.debug { "Importing #{qp} annotation #{name}..." } # Make the annotation module class scoped by this Annotatable class. class_eval("module #{name}; end") mod = const_get(name) # Append the AnnotationModule methods. mod.extend(Annotation::Import...
ruby
def import_annotation(name, opts) logger.debug { "Importing #{qp} annotation #{name}..." } # Make the annotation module class scoped by this Annotatable class. class_eval("module #{name}; end") mod = const_get(name) # Append the AnnotationModule methods. mod.extend(Annotation::Import...
[ "def", "import_annotation", "(", "name", ",", "opts", ")", "logger", ".", "debug", "{", "\"Importing #{qp} annotation #{name}...\"", "}", "class_eval", "(", "\"module #{name}; end\"", ")", "mod", "=", "const_get", "(", "name", ")", "mod", ".", "extend", "(", "An...
Builds a new annotation module for the given module name and options. @param [String] name the attribute module name @param opts (see #add_annotation) @return [Module] the annotation module @raise [AnnotationError] if there is no annotation proxy class
[ "Builds", "a", "new", "annotation", "module", "for", "the", "given", "module", "name", "and", "options", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/metadata.rb#L225-L235
valid
o2web/rails_admin_cms
app/controllers/cms/viewables_controller.rb
CMS.ViewablesController.create
def create current_count = UniqueKey.where(list_key_params).count if params[:max] == 'Infinity' || current_count < params[:max].to_i unique_key = list_key_params.merge(position: current_count + 1) viewable = UniqueKey.create_localized_viewable!(unique_key) if unique_key[:viewable_...
ruby
def create current_count = UniqueKey.where(list_key_params).count if params[:max] == 'Infinity' || current_count < params[:max].to_i unique_key = list_key_params.merge(position: current_count + 1) viewable = UniqueKey.create_localized_viewable!(unique_key) if unique_key[:viewable_...
[ "def", "create", "current_count", "=", "UniqueKey", ".", "where", "(", "list_key_params", ")", ".", "count", "if", "params", "[", ":max", "]", "==", "'Infinity'", "||", "current_count", "<", "params", "[", ":max", "]", ".", "to_i", "unique_key", "=", "list...
used by the add viewable link
[ "used", "by", "the", "add", "viewable", "link" ]
764197753a2beb80780a44c7f559ba2bc1bb429e
https://github.com/o2web/rails_admin_cms/blob/764197753a2beb80780a44c7f559ba2bc1bb429e/app/controllers/cms/viewables_controller.rb#L6-L24
valid
sugaryourcoffee/syc-svpro
lib/sycsvpro/header.rb
Sycsvpro.Header.process
def process(line, values = true) return "" if @header_cols.empty? && @insert_cols.empty? header_patterns = {} @row_cols = unstring(line).split(';') if @header_cols[0] == '*' @header_cols[0] = @row_cols else @header_cols.each_with_index do |h,i| if h =~ /^\(?c\d+(?...
ruby
def process(line, values = true) return "" if @header_cols.empty? && @insert_cols.empty? header_patterns = {} @row_cols = unstring(line).split(';') if @header_cols[0] == '*' @header_cols[0] = @row_cols else @header_cols.each_with_index do |h,i| if h =~ /^\(?c\d+(?...
[ "def", "process", "(", "line", ",", "values", "=", "true", ")", "return", "\"\"", "if", "@header_cols", ".", "empty?", "&&", "@insert_cols", ".", "empty?", "header_patterns", "=", "{", "}", "@row_cols", "=", "unstring", "(", "line", ")", ".", "split", "(...
Returns the header
[ "Returns", "the", "header" ]
a8f8b97283ee593b4e8d5092da46a1b0e39fc8e3
https://github.com/sugaryourcoffee/syc-svpro/blob/a8f8b97283ee593b4e8d5092da46a1b0e39fc8e3/lib/sycsvpro/header.rb#L35-L63
valid
obrie/turntabler
lib/turntabler/room.rb
Turntabler.Room.load
def load(options = {}) assert_valid_keys(options, :song_log) options = {:song_log => false}.merge(options) # Use a client that is connected on the same url this room is hosted on client = @client.url == url ? @client : Turntabler::Client.new(@client.user.id, @client.user.auth, :url => url, :tim...
ruby
def load(options = {}) assert_valid_keys(options, :song_log) options = {:song_log => false}.merge(options) # Use a client that is connected on the same url this room is hosted on client = @client.url == url ? @client : Turntabler::Client.new(@client.user.id, @client.user.auth, :url => url, :tim...
[ "def", "load", "(", "options", "=", "{", "}", ")", "assert_valid_keys", "(", "options", ",", ":song_log", ")", "options", "=", "{", ":song_log", "=>", "false", "}", ".", "merge", "(", "options", ")", "client", "=", "@client", ".", "url", "==", "url", ...
Loads the attributes for this room. Attributes will automatically load when accessed, but this allows data to be forcefully loaded upfront. @note This will open a connection to the chat server the room is hosted on if the client is not already connected to it @param [Hash] options The configuration options @optio...
[ "Loads", "the", "attributes", "for", "this", "room", ".", "Attributes", "will", "automatically", "load", "when", "accessed", "but", "this", "allows", "data", "to", "be", "forcefully", "loaded", "upfront", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/room.rb#L158-L173
valid
obrie/turntabler
lib/turntabler/room.rb
Turntabler.Room.attributes=
def attributes=(attrs) if attrs super('users' => attrs.delete('users')) if attrs['users'] super # Set room-level attributes that are specific to the song song_attributes = attrs['metadata'] && attrs['metadata'].select {|key, value| %w(upvotes downvotes votelog).include?(ke...
ruby
def attributes=(attrs) if attrs super('users' => attrs.delete('users')) if attrs['users'] super # Set room-level attributes that are specific to the song song_attributes = attrs['metadata'] && attrs['metadata'].select {|key, value| %w(upvotes downvotes votelog).include?(ke...
[ "def", "attributes", "=", "(", "attrs", ")", "if", "attrs", "super", "(", "'users'", "=>", "attrs", ".", "delete", "(", "'users'", ")", ")", "if", "attrs", "[", "'users'", "]", "super", "song_attributes", "=", "attrs", "[", "'metadata'", "]", "&&", "at...
Sets the current attributes for this room, ensuring that the full list of listeners gets set first so that we can use those built users to then fill out the collection of djs, moderators, etc. @api private @param [Hash] attrs The attributes to set
[ "Sets", "the", "current", "attributes", "for", "this", "room", "ensuring", "that", "the", "full", "list", "of", "listeners", "gets", "set", "first", "so", "that", "we", "can", "use", "those", "built", "users", "to", "then", "fill", "out", "the", "collectio...
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/room.rb#L181-L190
valid
obrie/turntabler
lib/turntabler/room.rb
Turntabler.Room.enter
def enter if client.room != self # Leave the old room client.room.leave if client.room # Connect and register with this room client.connect(url) begin client.room = self data = api('room.register', :section => nil) self.attributes = {'section'...
ruby
def enter if client.room != self # Leave the old room client.room.leave if client.room # Connect and register with this room client.connect(url) begin client.room = self data = api('room.register', :section => nil) self.attributes = {'section'...
[ "def", "enter", "if", "client", ".", "room", "!=", "self", "client", ".", "room", ".", "leave", "if", "client", ".", "room", "client", ".", "connect", "(", "url", ")", "begin", "client", ".", "room", "=", "self", "data", "=", "api", "(", "'room.regis...
Enters the current room. @note This will leave any room the user is already currently in (unless the same room is being entered) @return [true] @raise [Turntabler::Error] if the command fails @example room.enter # => true
[ "Enters", "the", "current", "room", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/room.rb#L216-L234
valid
obrie/turntabler
lib/turntabler/room.rb
Turntabler.Room.sticker_placements=
def sticker_placements=(user_placements) user_placements.each do |user_id, placements| listener(user_id).attributes = {'placements' => placements} end end
ruby
def sticker_placements=(user_placements) user_placements.each do |user_id, placements| listener(user_id).attributes = {'placements' => placements} end end
[ "def", "sticker_placements", "=", "(", "user_placements", ")", "user_placements", ".", "each", "do", "|", "user_id", ",", "placements", "|", "listener", "(", "user_id", ")", ".", "attributes", "=", "{", "'placements'", "=>", "placements", "}", "end", "end" ]
Sets the sticker placements for each dj
[ "Sets", "the", "sticker", "placements", "for", "each", "dj" ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/room.rb#L387-L391
valid
obrie/turntabler
lib/turntabler/song.rb
Turntabler.Song.skip
def skip assert_current_song api('room.stop_song', :songid => id, :djid => played_by.id, :roomid => room.id, :section => room.section) true end
ruby
def skip assert_current_song api('room.stop_song', :songid => id, :djid => played_by.id, :roomid => room.id, :section => room.section) true end
[ "def", "skip", "assert_current_song", "api", "(", "'room.stop_song'", ",", ":songid", "=>", "id", ",", ":djid", "=>", "played_by", ".", "id", ",", ":roomid", "=>", "room", ".", "id", ",", ":section", "=>", "room", ".", "section", ")", "true", "end" ]
Skips the song. @return [true] @raise [Turntabler::Error] if the command fails @raise [Turntabler::Error] if the song is not playing in the current song @example song.skip # => true
[ "Skips", "the", "song", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/song.rb#L152-L156
valid
obrie/turntabler
lib/turntabler/song.rb
Turntabler.Song.vote
def vote(direction = :up) assert_current_song api('room.vote', :roomid => room.id, :section => room.section, :val => direction, :songid => id, :vh => digest("#{room.id}#{direction}#{id}"), :th => digest(rand), :ph => digest(rand) ) true ...
ruby
def vote(direction = :up) assert_current_song api('room.vote', :roomid => room.id, :section => room.section, :val => direction, :songid => id, :vh => digest("#{room.id}#{direction}#{id}"), :th => digest(rand), :ph => digest(rand) ) true ...
[ "def", "vote", "(", "direction", "=", ":up", ")", "assert_current_song", "api", "(", "'room.vote'", ",", ":roomid", "=>", "room", ".", "id", ",", ":section", "=>", "room", ".", "section", ",", ":val", "=>", "direction", ",", ":songid", "=>", "id", ",", ...
Vote for the song. @param [Symbol] direction The direction to vote the song (:up or :down) @return [true] @raise [Turntabler::Error] if the command fails @raise [Turntabler::Error] if the song is not playing in the current song @example song.vote # => true song.vote(:down) # => true
[ "Vote", "for", "the", "song", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/song.rb#L167-L179
valid
obrie/turntabler
lib/turntabler/song.rb
Turntabler.Song.snag
def snag assert_current_song sh = digest(rand) api('snag.add', :djid => room.current_dj.id, :songid => id, :roomid => room.id, :section => room.section, :site => 'queue', :location => 'board', :in_queue => 'false', :blocked => 'false', ...
ruby
def snag assert_current_song sh = digest(rand) api('snag.add', :djid => room.current_dj.id, :songid => id, :roomid => room.id, :section => room.section, :site => 'queue', :location => 'board', :in_queue => 'false', :blocked => 'false', ...
[ "def", "snag", "assert_current_song", "sh", "=", "digest", "(", "rand", ")", "api", "(", "'snag.add'", ",", ":djid", "=>", "room", ".", "current_dj", ".", "id", ",", ":songid", "=>", "id", ",", ":roomid", "=>", "room", ".", "id", ",", ":section", "=>",...
Triggers the heart animation for the song. @note This will not add the song to the user's playlist @return [true] @raise [Turntabler::Error] if the command fails @raise [Turntabler::Error] if the song is not playing in the current song @example song.snag # => true
[ "Triggers", "the", "heart", "animation", "for", "the", "song", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/song.rb#L189-L206
valid
obrie/turntabler
lib/turntabler/song.rb
Turntabler.Song.add
def add(options = {}) assert_valid_keys(options, :playlist, :index) options = {:playlist => playlist.id, :index => 0}.merge(options) # Create a copy of the song so that the playlist can get set properly song = dup song.attributes = {:playlist => options[:playlist]} playlist, index =...
ruby
def add(options = {}) assert_valid_keys(options, :playlist, :index) options = {:playlist => playlist.id, :index => 0}.merge(options) # Create a copy of the song so that the playlist can get set properly song = dup song.attributes = {:playlist => options[:playlist]} playlist, index =...
[ "def", "add", "(", "options", "=", "{", "}", ")", "assert_valid_keys", "(", "options", ",", ":playlist", ",", ":index", ")", "options", "=", "{", ":playlist", "=>", "playlist", ".", "id", ",", ":index", "=>", "0", "}", ".", "merge", "(", "options", "...
Adds the song to one of the user's playlists. @param [Hash] options The options for where to add the song @option options [String] :playlist ("default") The playlist to add the song in @option options [Fixnum] :index (0) The location in the playlist to insert the song @return [true] @raise [ArgumentError] if an i...
[ "Adds", "the", "song", "to", "one", "of", "the", "user", "s", "playlists", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/song.rb#L218-L230
valid
obrie/turntabler
lib/turntabler/song.rb
Turntabler.Song.move
def move(to_index) api('playlist.reorder', :playlist_name => playlist.id, :index_from => index, :index_to => to_index) playlist.songs.insert(to_index, playlist.songs.delete(self)) true end
ruby
def move(to_index) api('playlist.reorder', :playlist_name => playlist.id, :index_from => index, :index_to => to_index) playlist.songs.insert(to_index, playlist.songs.delete(self)) true end
[ "def", "move", "(", "to_index", ")", "api", "(", "'playlist.reorder'", ",", ":playlist_name", "=>", "playlist", ".", "id", ",", ":index_from", "=>", "index", ",", ":index_to", "=>", "to_index", ")", "playlist", ".", "songs", ".", "insert", "(", "to_index", ...
Move a song from one location in the playlist to another. @param [Fixnum] to_index The index to move the song to @return [true] @raise [ArgumentError] if an invalid option is specified @raise [Turntabler::Error] if the command fails song.move(5) # => true
[ "Move", "a", "song", "from", "one", "location", "in", "the", "playlist", "to", "another", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/song.rb#L252-L256
valid
caruby/tissue
lib/catissue/helpers/storage_type_holder.rb
CaTissue.StorageTypeHolder.add_child_type
def add_child_type(type) case type when CaTissue::StorageType then add_storage_type(type) when CaTissue::SpecimenArrayType then add_specimen_array_type(type) when String then add_specimen_class(type) else raise ArgumentError.new("Storage type child not supported - #{type}") e...
ruby
def add_child_type(type) case type when CaTissue::StorageType then add_storage_type(type) when CaTissue::SpecimenArrayType then add_specimen_array_type(type) when String then add_specimen_class(type) else raise ArgumentError.new("Storage type child not supported - #{type}") e...
[ "def", "add_child_type", "(", "type", ")", "case", "type", "when", "CaTissue", "::", "StorageType", "then", "add_storage_type", "(", "type", ")", "when", "CaTissue", "::", "SpecimenArrayType", "then", "add_specimen_array_type", "(", "type", ")", "when", "String", ...
Adds the given subtype to the list of subtypes which this StorageType can hold. @param [CaTissue::StorageType, CaTissue::SpecimenArrayType, String] the subcontainer type or {CaTissue::AbstractSpecimen#specimen_class} which this StorageType can hold @return [StorageTypeHolder] self @raise [ArgumentError] if the t...
[ "Adds", "the", "given", "subtype", "to", "the", "list", "of", "subtypes", "which", "this", "StorageType", "can", "hold", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/helpers/storage_type_holder.rb#L41-L49
valid
caruby/tissue
lib/catissue/helpers/storage_type_holder.rb
CaTissue.StorageTypeHolder.copy_child_types
def copy_child_types(other) child_storage_types.merge!(other.child_storage_types) child_specimen_array_types.merge!(other.child_specimen_array_types) child_specimen_classes.merge!(other.child_specimen_classes) end
ruby
def copy_child_types(other) child_storage_types.merge!(other.child_storage_types) child_specimen_array_types.merge!(other.child_specimen_array_types) child_specimen_classes.merge!(other.child_specimen_classes) end
[ "def", "copy_child_types", "(", "other", ")", "child_storage_types", ".", "merge!", "(", "other", ".", "child_storage_types", ")", "child_specimen_array_types", ".", "merge!", "(", "other", ".", "child_specimen_array_types", ")", "child_specimen_classes", ".", "merge!",...
Copies the other child types into this container's child types. @param [StorageTypeHolder] other the source child type holder
[ "Copies", "the", "other", "child", "types", "into", "this", "container", "s", "child", "types", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/helpers/storage_type_holder.rb#L56-L60
valid
fastpeek/steamd
lib/steamd/cli.rb
Steamd.Cli.generate
def generate opts = CliOptions.new(options) # options is built by Thor gen = CodeGenerator.new(opts.input, opts.output) gen.generate end
ruby
def generate opts = CliOptions.new(options) # options is built by Thor gen = CodeGenerator.new(opts.input, opts.output) gen.generate end
[ "def", "generate", "opts", "=", "CliOptions", ".", "new", "(", "options", ")", "gen", "=", "CodeGenerator", ".", "new", "(", "opts", ".", "input", ",", "opts", ".", "output", ")", "gen", ".", "generate", "end" ]
Generate Ruby code for Steam Language
[ "Generate", "Ruby", "code", "for", "Steam", "Language" ]
8e66e78369ec735223995ea31a125b73541dfa3e
https://github.com/fastpeek/steamd/blob/8e66e78369ec735223995ea31a125b73541dfa3e/lib/steamd/cli.rb#L16-L20
valid
fastpeek/steamd
lib/steamd/parser.rb
Steamd.Parser.load!
def load! return if loaded? Treetop.load("#{Steamd.grammar_dir}/shared.treetop") Dir.glob("#{Steamd.grammar_dir}/*.treetop") do |file| Treetop.load(file) end @parser = SteamdParser.new true end
ruby
def load! return if loaded? Treetop.load("#{Steamd.grammar_dir}/shared.treetop") Dir.glob("#{Steamd.grammar_dir}/*.treetop") do |file| Treetop.load(file) end @parser = SteamdParser.new true end
[ "def", "load!", "return", "if", "loaded?", "Treetop", ".", "load", "(", "\"#{Steamd.grammar_dir}/shared.treetop\"", ")", "Dir", ".", "glob", "(", "\"#{Steamd.grammar_dir}/*.treetop\"", ")", "do", "|", "file", "|", "Treetop", ".", "load", "(", "file", ")", "end",...
Load the grammars @return [Bool] returns true unless an exception is thrown
[ "Load", "the", "grammars" ]
8e66e78369ec735223995ea31a125b73541dfa3e
https://github.com/fastpeek/steamd/blob/8e66e78369ec735223995ea31a125b73541dfa3e/lib/steamd/parser.rb#L30-L41
valid
fastpeek/steamd
lib/steamd/parser.rb
Steamd.Parser.parse
def parse(io) io.rewind raise NotLoadedError, 'load before parsing (#load!)' if @parser.nil? data = strip_comments_and_obsolete_tags!(io) @tree = @parser.parse(data) raise_parser_error! if @tree.nil? true end
ruby
def parse(io) io.rewind raise NotLoadedError, 'load before parsing (#load!)' if @parser.nil? data = strip_comments_and_obsolete_tags!(io) @tree = @parser.parse(data) raise_parser_error! if @tree.nil? true end
[ "def", "parse", "(", "io", ")", "io", ".", "rewind", "raise", "NotLoadedError", ",", "'load before parsing (#load!)'", "if", "@parser", ".", "nil?", "data", "=", "strip_comments_and_obsolete_tags!", "(", "io", ")", "@tree", "=", "@parser", ".", "parse", "(", "...
Parses an IO stream. @param io [#read, #rewind] An IO stream containing the Steam Language data. @return [Bool] returns true unless an error is thrown
[ "Parses", "an", "IO", "stream", "." ]
8e66e78369ec735223995ea31a125b73541dfa3e
https://github.com/fastpeek/steamd/blob/8e66e78369ec735223995ea31a125b73541dfa3e/lib/steamd/parser.rb#L48-L58
valid
fastpeek/steamd
lib/steamd/parser.rb
Steamd.Parser.imports
def imports raise StreamNotParsed, 'you must parse first' if @tree.nil? imports = statements.select do |node| node.is_a?(ImportStatement) end imports.map(&:to_hash) end
ruby
def imports raise StreamNotParsed, 'you must parse first' if @tree.nil? imports = statements.select do |node| node.is_a?(ImportStatement) end imports.map(&:to_hash) end
[ "def", "imports", "raise", "StreamNotParsed", ",", "'you must parse first'", "if", "@tree", ".", "nil?", "imports", "=", "statements", ".", "select", "do", "|", "node", "|", "node", ".", "is_a?", "(", "ImportStatement", ")", "end", "imports", ".", "map", "("...
An array of hashes containing the imports found in the parsed Steam Language file. The hash is the hash version of ImportStatement @example Accessing imports parser.imports # => [{filename: 'test'}] @return [Array<Hash>] an array of hashes representing the imports found @see ImportStatement
[ "An", "array", "of", "hashes", "containing", "the", "imports", "found", "in", "the", "parsed", "Steam", "Language", "file", "." ]
8e66e78369ec735223995ea31a125b73541dfa3e
https://github.com/fastpeek/steamd/blob/8e66e78369ec735223995ea31a125b73541dfa3e/lib/steamd/parser.rb#L70-L78
valid
fastpeek/steamd
lib/steamd/parser.rb
Steamd.Parser.classes
def classes raise StreamNotParsed, 'you must parse first' if @tree.nil? classes = statements.select do |node| node.is_a?(ClassStatement) end classes.map(&:to_hash) end
ruby
def classes raise StreamNotParsed, 'you must parse first' if @tree.nil? classes = statements.select do |node| node.is_a?(ClassStatement) end classes.map(&:to_hash) end
[ "def", "classes", "raise", "StreamNotParsed", ",", "'you must parse first'", "if", "@tree", ".", "nil?", "classes", "=", "statements", ".", "select", "do", "|", "node", "|", "node", ".", "is_a?", "(", "ClassStatement", ")", "end", "classes", ".", "map", "(",...
Returns an array of classes parsed from the IO stream. The array contains hashes with class information and variables. The hash is the hash form of ClassStatement @example Accessing the classes parser.classes # => [{ name: 'test', variables: [], ...] @return [Array<Hash>] an array of hashes representing the c...
[ "Returns", "an", "array", "of", "classes", "parsed", "from", "the", "IO", "stream", ".", "The", "array", "contains", "hashes", "with", "class", "information", "and", "variables", "." ]
8e66e78369ec735223995ea31a125b73541dfa3e
https://github.com/fastpeek/steamd/blob/8e66e78369ec735223995ea31a125b73541dfa3e/lib/steamd/parser.rb#L90-L98
valid
fastpeek/steamd
lib/steamd/parser.rb
Steamd.Parser.enums
def enums raise StreamNotParsed, 'you must parse first' if @tree.nil? enums = statements.select do |node| node.is_a?(EnumStatement) end enums.map(&:to_hash) end
ruby
def enums raise StreamNotParsed, 'you must parse first' if @tree.nil? enums = statements.select do |node| node.is_a?(EnumStatement) end enums.map(&:to_hash) end
[ "def", "enums", "raise", "StreamNotParsed", ",", "'you must parse first'", "if", "@tree", ".", "nil?", "enums", "=", "statements", ".", "select", "do", "|", "node", "|", "node", ".", "is_a?", "(", "EnumStatement", ")", "end", "enums", ".", "map", "(", "&",...
Returns an array of eneums parsed from the IO stream. The array contains hashes with enum information and variables. The hash is the hash form of EnumStatement @example Accessing the enums parser.enums # => [{ name: 'test', variables: [], ...] @return [Array<Hash>] an array of hashes representing the class @...
[ "Returns", "an", "array", "of", "eneums", "parsed", "from", "the", "IO", "stream", ".", "The", "array", "contains", "hashes", "with", "enum", "information", "and", "variables", "." ]
8e66e78369ec735223995ea31a125b73541dfa3e
https://github.com/fastpeek/steamd/blob/8e66e78369ec735223995ea31a125b73541dfa3e/lib/steamd/parser.rb#L110-L118
valid
pmahoney/mini_aether
lib/mini_aether/xml_parser.rb
MiniAether.XmlParser.pull_to_start
def pull_to_start(name) loop do res = pull raise NotFoundError if res.event_type == :end_document next if res.start_element? && res[0] == name.to_s end end
ruby
def pull_to_start(name) loop do res = pull raise NotFoundError if res.event_type == :end_document next if res.start_element? && res[0] == name.to_s end end
[ "def", "pull_to_start", "(", "name", ")", "loop", "do", "res", "=", "pull", "raise", "NotFoundError", "if", "res", ".", "event_type", "==", ":end_document", "next", "if", "res", ".", "start_element?", "&&", "res", "[", "0", "]", "==", "name", ".", "to_s"...
Pull events until the start of an element of tag name +name+ is reached.
[ "Pull", "events", "until", "the", "start", "of", "an", "element", "of", "tag", "name", "+", "name", "+", "is", "reached", "." ]
0359967c2fa5fd9ba8bd05b12567e307b44ea7a4
https://github.com/pmahoney/mini_aether/blob/0359967c2fa5fd9ba8bd05b12567e307b44ea7a4/lib/mini_aether/xml_parser.rb#L13-L19
valid
pmahoney/mini_aether
lib/mini_aether/xml_parser.rb
MiniAether.XmlParser.pull_text_until_end
def pull_text_until_end texts = [] loop do res = pull break unless res.text? texts << res[0] end texts.join end
ruby
def pull_text_until_end texts = [] loop do res = pull break unless res.text? texts << res[0] end texts.join end
[ "def", "pull_text_until_end", "texts", "=", "[", "]", "loop", "do", "res", "=", "pull", "break", "unless", "res", ".", "text?", "texts", "<<", "res", "[", "0", "]", "end", "texts", ".", "join", "end" ]
Pull all text nodes until the next +end_element+ event. Return the concatenation of text nodes.
[ "Pull", "all", "text", "nodes", "until", "the", "next", "+", "end_element", "+", "event", ".", "Return", "the", "concatenation", "of", "text", "nodes", "." ]
0359967c2fa5fd9ba8bd05b12567e307b44ea7a4
https://github.com/pmahoney/mini_aether/blob/0359967c2fa5fd9ba8bd05b12567e307b44ea7a4/lib/mini_aether/xml_parser.rb#L29-L37
valid
jparker/comparison
lib/comparison/presenter.rb
Comparison.Presenter.dom_classes
def dom_classes if positive? t 'comparison.dom_classes.positive', default: %i[comparison.classes.positive] elsif negative? t 'comparison.dom_classes.negative', default: %i[comparison.classes.negative] else t 'comparison.dom_classes.nochange', defau...
ruby
def dom_classes if positive? t 'comparison.dom_classes.positive', default: %i[comparison.classes.positive] elsif negative? t 'comparison.dom_classes.negative', default: %i[comparison.classes.negative] else t 'comparison.dom_classes.nochange', defau...
[ "def", "dom_classes", "if", "positive?", "t", "'comparison.dom_classes.positive'", ",", "default", ":", "%i[", "comparison.classes.positive", "]", "elsif", "negative?", "t", "'comparison.dom_classes.negative'", ",", "default", ":", "%i[", "comparison.classes.negative", "]",...
Returns the I18n translation for `comparison.dom_classes`. Use these translations to specify CSS classes for tags that contain comparison data. For example: en: comparison: dom_classes: positive: 'comparison positive' negative: 'comparison negative' nochange: 'c...
[ "Returns", "the", "I18n", "translation", "for", "comparison", ".", "dom_classes", "." ]
b268d30b01eed422c10f2c7b5b2987f05fb1a00c
https://github.com/jparker/comparison/blob/b268d30b01eed422c10f2c7b5b2987f05fb1a00c/lib/comparison/presenter.rb#L146-L157
valid
sugaryourcoffee/syc-svpro
lib/sycsvpro/column_type_filter.rb
Sycsvpro.ColumnTypeFilter.process
def process(object, options={}) filtered = super(object, options) return nil if filtered.nil? values = filtered.split(';') values.each_with_index do |value, index| if types[index] == 'n' if value =~ /\./ number_value = value.to_f else number...
ruby
def process(object, options={}) filtered = super(object, options) return nil if filtered.nil? values = filtered.split(';') values.each_with_index do |value, index| if types[index] == 'n' if value =~ /\./ number_value = value.to_f else number...
[ "def", "process", "(", "object", ",", "options", "=", "{", "}", ")", "filtered", "=", "super", "(", "object", ",", "options", ")", "return", "nil", "if", "filtered", ".", "nil?", "values", "=", "filtered", ".", "split", "(", "';'", ")", "values", "."...
Processes the filter and returns the filtered columns
[ "Processes", "the", "filter", "and", "returns", "the", "filtered", "columns" ]
a8f8b97283ee593b4e8d5092da46a1b0e39fc8e3
https://github.com/sugaryourcoffee/syc-svpro/blob/a8f8b97283ee593b4e8d5092da46a1b0e39fc8e3/lib/sycsvpro/column_type_filter.rb#L8-L38
valid
nbaum/blower
lib/blower/logger.rb
Blower.Logger.log
def log (level, message, quiet: false, &block) if !quiet && (LEVELS.index(level) >= LEVELS.index(Logger.level)) synchronize do message = message.to_s.colorize(COLORS[level]) if level message.split("\n").each do |line| STDERR.puts " " * Logger.indent + @prefix + line ...
ruby
def log (level, message, quiet: false, &block) if !quiet && (LEVELS.index(level) >= LEVELS.index(Logger.level)) synchronize do message = message.to_s.colorize(COLORS[level]) if level message.split("\n").each do |line| STDERR.puts " " * Logger.indent + @prefix + line ...
[ "def", "log", "(", "level", ",", "message", ",", "quiet", ":", "false", ",", "&", "block", ")", "if", "!", "quiet", "&&", "(", "LEVELS", ".", "index", "(", "level", ")", ">=", "LEVELS", ".", "index", "(", "Logger", ".", "level", ")", ")", "synchr...
Display a log message. The block, if specified, is executed in an indented region after the log message is shown. @api private @param [Symbol] level the severity level @param [#to_s] message the message to display @param block a block to execute with an indent after the message is displayed @return the value of bl...
[ "Display", "a", "log", "message", ".", "The", "block", "if", "specified", "is", "executed", "in", "an", "indented", "region", "after", "the", "log", "message", "is", "shown", "." ]
9e09a56f9d4bf547bf1aa1843d894be625a27628
https://github.com/nbaum/blower/blob/9e09a56f9d4bf547bf1aa1843d894be625a27628/lib/blower/logger.rb#L64-L76
valid
caruby/tissue
lib/catissue/domain/user.rb
CaTissue.User.role_id=
def role_id=(value) # value as an integer (nil is zero) value_i = value.to_i # set the Bug #66 work-around i.v. @role_id = value_i.zero? ? nil : value_i # value as a String (if non-nil) value_s = @role_id.to_s if @role_id # call Java with a String setRoleId(value_s) e...
ruby
def role_id=(value) # value as an integer (nil is zero) value_i = value.to_i # set the Bug #66 work-around i.v. @role_id = value_i.zero? ? nil : value_i # value as a String (if non-nil) value_s = @role_id.to_s if @role_id # call Java with a String setRoleId(value_s) e...
[ "def", "role_id", "=", "(", "value", ")", "value_i", "=", "value", ".", "to_i", "@role_id", "=", "value_i", ".", "zero?", "?", "nil", ":", "value_i", "value_s", "=", "@role_id", ".", "to_s", "if", "@role_id", "setRoleId", "(", "value_s", ")", "end" ]
Sets the role id to the given value, which can be either a String or an Integer. An empty or zero value is converted to nil. @quirk caTissue caTissue API roleId is a String although the intended value domain is the integer csm_role.identifier.
[ "Sets", "the", "role", "id", "to", "the", "given", "value", "which", "can", "be", "either", "a", "String", "or", "an", "Integer", ".", "An", "empty", "or", "zero", "value", "is", "converted", "to", "nil", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/domain/user.rb#L32-L41
valid
Smartibuy/SecondHandler
lib/second_handler.rb
SecondHandler.FbGroupPost.get_content
def get_content (&func) data = Array.new @feed.to_a.each do |single_post| begin if func.nil? data << clean_post_content(single_post, &@message_parser) else data << clean_post_content(single_post, &func) end rescue end end ...
ruby
def get_content (&func) data = Array.new @feed.to_a.each do |single_post| begin if func.nil? data << clean_post_content(single_post, &@message_parser) else data << clean_post_content(single_post, &func) end rescue end end ...
[ "def", "get_content", "(", "&", "func", ")", "data", "=", "Array", ".", "new", "@feed", ".", "to_a", ".", "each", "do", "|", "single_post", "|", "begin", "if", "func", ".", "nil?", "data", "<<", "clean_post_content", "(", "single_post", ",", "&", "@mes...
return feed of current page infomation , including image
[ "return", "feed", "of", "current", "page", "infomation", "including", "image" ]
b44b5d65b8735a3372376c4b701d3d46e0d7e09c
https://github.com/Smartibuy/SecondHandler/blob/b44b5d65b8735a3372376c4b701d3d46e0d7e09c/lib/second_handler.rb#L146-L159
valid
caruby/tissue
lib/catissue/database/controlled_value_finder.rb
CaTissue.ControlledValueFinder.controlled_value
def controlled_value(value) return if value.blank? ControlledValues.instance.find(@attribute, value) or raise ControlledValueError.new("#{@attribute} value '#{value}' is not a recognized controlled value.") end
ruby
def controlled_value(value) return if value.blank? ControlledValues.instance.find(@attribute, value) or raise ControlledValueError.new("#{@attribute} value '#{value}' is not a recognized controlled value.") end
[ "def", "controlled_value", "(", "value", ")", "return", "if", "value", ".", "blank?", "ControlledValues", ".", "instance", ".", "find", "(", "@attribute", ",", "value", ")", "or", "raise", "ControlledValueError", ".", "new", "(", "\"#{@attribute} value '#{value}' ...
Creates a new ControlledValueFinder for the given attribute. The optional YAML properties file name maps input values to controlled values. @param [Symbol] attribute the CV attribute Returns the CV value for the given source value. A case-insensitive lookup is performed on the CV. @param [String, nil] value the ...
[ "Creates", "a", "new", "ControlledValueFinder", "for", "the", "given", "attribute", ".", "The", "optional", "YAML", "properties", "file", "name", "maps", "input", "values", "to", "controlled", "values", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/database/controlled_value_finder.rb#L22-L26
valid
knuedge/cratus
lib/cratus/config.rb
Cratus.Config.defaults
def defaults { group_dn_attribute: :cn, group_member_attribute: :member, group_description_attribute: :description, group_objectclass: :group, group_basedn: 'ou=groups,dc=example,dc=com', group_memberof_attribute: :memberOf, user_dn_attribute: :samaccountnam...
ruby
def defaults { group_dn_attribute: :cn, group_member_attribute: :member, group_description_attribute: :description, group_objectclass: :group, group_basedn: 'ou=groups,dc=example,dc=com', group_memberof_attribute: :memberOf, user_dn_attribute: :samaccountnam...
[ "def", "defaults", "{", "group_dn_attribute", ":", ":cn", ",", "group_member_attribute", ":", ":member", ",", "group_description_attribute", ":", ":description", ",", "group_objectclass", ":", ":group", ",", "group_basedn", ":", "'ou=groups,dc=example,dc=com'", ",", "gr...
A Hash of the default configuration options
[ "A", "Hash", "of", "the", "default", "configuration", "options" ]
a58465314a957db258f2c6bbda115c4be8ad0d83
https://github.com/knuedge/cratus/blob/a58465314a957db258f2c6bbda115c4be8ad0d83/lib/cratus/config.rb#L6-L29
valid
jonathanpike/mako
lib/mako/subscription_list_writer.rb
Mako.SubscriptionListWriter.append_and_write
def append_and_write contents = append_and_render File.open(destination, 'w+', encoding: 'utf-8') do |f| f.write(contents) end end
ruby
def append_and_write contents = append_and_render File.open(destination, 'w+', encoding: 'utf-8') do |f| f.write(contents) end end
[ "def", "append_and_write", "contents", "=", "append_and_render", "File", ".", "open", "(", "destination", ",", "'w+'", ",", "encoding", ":", "'utf-8'", ")", "do", "|", "f", "|", "f", ".", "write", "(", "contents", ")", "end", "end" ]
Appends the new subscriptions to the subscription list and writes the results out to the file.
[ "Appends", "the", "new", "subscriptions", "to", "the", "subscription", "list", "and", "writes", "the", "results", "out", "to", "the", "file", "." ]
2aa3665ebf23f09727e59d667b34155755493bdf
https://github.com/jonathanpike/mako/blob/2aa3665ebf23f09727e59d667b34155755493bdf/lib/mako/subscription_list_writer.rb#L16-L21
valid
jonathanpike/mako
lib/mako/subscription_list_writer.rb
Mako.SubscriptionListWriter.render_opml
def render_opml(list) document = Nokogiri::XML(list.load_list) feeds.each do |feed_url| node = "<outline xmlUrl='#{feed_url}' />\n" document.xpath("//outline[@text='Subscriptions']").last.add_child node end formatted_no_decl = Nokogiri::XML::Node::SaveOptions::FORMAT + ...
ruby
def render_opml(list) document = Nokogiri::XML(list.load_list) feeds.each do |feed_url| node = "<outline xmlUrl='#{feed_url}' />\n" document.xpath("//outline[@text='Subscriptions']").last.add_child node end formatted_no_decl = Nokogiri::XML::Node::SaveOptions::FORMAT + ...
[ "def", "render_opml", "(", "list", ")", "document", "=", "Nokogiri", "::", "XML", "(", "list", ".", "load_list", ")", "feeds", ".", "each", "do", "|", "feed_url", "|", "node", "=", "\"<outline xmlUrl='#{feed_url}' />\\n\"", "document", ".", "xpath", "(", "\"...
Append feeds to current subscription list and return XML document @return [String]
[ "Append", "feeds", "to", "current", "subscription", "list", "and", "return", "XML", "document" ]
2aa3665ebf23f09727e59d667b34155755493bdf
https://github.com/jonathanpike/mako/blob/2aa3665ebf23f09727e59d667b34155755493bdf/lib/mako/subscription_list_writer.rb#L58-L67
valid
sugaryourcoffee/syc-svpro
lib/sycsvpro/calculator.rb
Sycsvpro.Calculator.execute
def execute processed_header = false File.open(outfile, 'w') do |out| File.open(infile).each_with_index do |line, index| next if line.chomp.empty? || unstring(line).chomp.split(';').empty? unless processed_header header_row = header.process(line.chomp) h...
ruby
def execute processed_header = false File.open(outfile, 'w') do |out| File.open(infile).each_with_index do |line, index| next if line.chomp.empty? || unstring(line).chomp.split(';').empty? unless processed_header header_row = header.process(line.chomp) h...
[ "def", "execute", "processed_header", "=", "false", "File", ".", "open", "(", "outfile", ",", "'w'", ")", "do", "|", "out", "|", "File", ".", "open", "(", "infile", ")", ".", "each_with_index", "do", "|", "line", ",", "index", "|", "next", "if", "lin...
Executes the calculator and writes the result to the _outfile_
[ "Executes", "the", "calculator", "and", "writes", "the", "result", "to", "the", "_outfile_" ]
a8f8b97283ee593b4e8d5092da46a1b0e39fc8e3
https://github.com/sugaryourcoffee/syc-svpro/blob/a8f8b97283ee593b4e8d5092da46a1b0e39fc8e3/lib/sycsvpro/calculator.rb#L118-L156
valid
sugaryourcoffee/syc-svpro
lib/sycsvpro/calculator.rb
Sycsvpro.Calculator.to_date
def to_date(value) if value.nil? or value.strip.empty? nil else Date.strptime(value, date_format) end end
ruby
def to_date(value) if value.nil? or value.strip.empty? nil else Date.strptime(value, date_format) end end
[ "def", "to_date", "(", "value", ")", "if", "value", ".", "nil?", "or", "value", ".", "strip", ".", "empty?", "nil", "else", "Date", ".", "strptime", "(", "value", ",", "date_format", ")", "end", "end" ]
Casts a string to a date
[ "Casts", "a", "string", "to", "a", "date" ]
a8f8b97283ee593b4e8d5092da46a1b0e39fc8e3
https://github.com/sugaryourcoffee/syc-svpro/blob/a8f8b97283ee593b4e8d5092da46a1b0e39fc8e3/lib/sycsvpro/calculator.rb#L184-L190
valid
knuedge/cratus
lib/cratus/group.rb
Cratus.Group.add_user
def add_user(user) raise 'InvalidUser' unless user.respond_to?(:dn) direct_members = @raw_ldap_data[Cratus.config.group_member_attribute] return true if direct_members.include?(user.dn) direct_members << user.dn Cratus::LDAP.replace_attribute( dn, Cratus.config.group_membe...
ruby
def add_user(user) raise 'InvalidUser' unless user.respond_to?(:dn) direct_members = @raw_ldap_data[Cratus.config.group_member_attribute] return true if direct_members.include?(user.dn) direct_members << user.dn Cratus::LDAP.replace_attribute( dn, Cratus.config.group_membe...
[ "def", "add_user", "(", "user", ")", "raise", "'InvalidUser'", "unless", "user", ".", "respond_to?", "(", ":dn", ")", "direct_members", "=", "@raw_ldap_data", "[", "Cratus", ".", "config", ".", "group_member_attribute", "]", "return", "true", "if", "direct_membe...
Add a User to the group
[ "Add", "a", "User", "to", "the", "group" ]
a58465314a957db258f2c6bbda115c4be8ad0d83
https://github.com/knuedge/cratus/blob/a58465314a957db258f2c6bbda115c4be8ad0d83/lib/cratus/group.rb#L63-L74
valid
caruby/tissue
lib/catissue/database/annotation/annotator.rb
CaTissue.Annotator.create_annotation_service
def create_annotation_service(mod, name) @integrator = Annotation::Integrator.new(mod) Annotation::AnnotationService.new(@database, name, @integrator) end
ruby
def create_annotation_service(mod, name) @integrator = Annotation::Integrator.new(mod) Annotation::AnnotationService.new(@database, name, @integrator) end
[ "def", "create_annotation_service", "(", "mod", ",", "name", ")", "@integrator", "=", "Annotation", "::", "Integrator", ".", "new", "(", "mod", ")", "Annotation", "::", "AnnotationService", ".", "new", "(", "@database", ",", "name", ",", "@integrator", ")", ...
Initializes a new Annotator for the given database. @param [CaTissue::Database] the database @param [Module] the annotation module @param [String] name the service name @return [Annotation::AnnotationService] the annotation service
[ "Initializes", "a", "new", "Annotator", "for", "the", "given", "database", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/database/annotation/annotator.rb#L20-L23
valid
caruby/tissue
lib/catissue/helpers/person.rb
CaTissue.Person.name
def name middle = middle_name if respond_to?(:middle_name) Name.new(last_name, first_name, middle) if last_name end
ruby
def name middle = middle_name if respond_to?(:middle_name) Name.new(last_name, first_name, middle) if last_name end
[ "def", "name", "middle", "=", "middle_name", "if", "respond_to?", "(", ":middle_name", ")", "Name", ".", "new", "(", "last_name", ",", "first_name", ",", "middle", ")", "if", "last_name", "end" ]
Returns this Person's name as a Name structure, or nil if there is no last name.
[ "Returns", "this", "Person", "s", "name", "as", "a", "Name", "structure", "or", "nil", "if", "there", "is", "no", "last", "name", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/helpers/person.rb#L11-L14
valid
caruby/tissue
lib/catissue/helpers/person.rb
CaTissue.Person.name=
def name=(value) value = Name.parse(value) if String === value # a missing name is equivalent to an empty name for our purposes here value = Name.new(nil, nil) if value.nil? unless Name === value then raise ArgumentError.new("Name argument type invalid; expected <#{Name}>, found <#{value...
ruby
def name=(value) value = Name.parse(value) if String === value # a missing name is equivalent to an empty name for our purposes here value = Name.new(nil, nil) if value.nil? unless Name === value then raise ArgumentError.new("Name argument type invalid; expected <#{Name}>, found <#{value...
[ "def", "name", "=", "(", "value", ")", "value", "=", "Name", ".", "parse", "(", "value", ")", "if", "String", "===", "value", "value", "=", "Name", ".", "new", "(", "nil", ",", "nil", ")", "if", "value", ".", "nil?", "unless", "Name", "===", "val...
Sets this Person's name to the name string or Name object. A string name argument is parsed using Name.parse. @quirk caTissue CaTissue person names are inconsistent: Participant has a middle name, User doesn't.
[ "Sets", "this", "Person", "s", "name", "to", "the", "name", "string", "or", "Name", "object", ".", "A", "string", "name", "argument", "is", "parsed", "using", "Name", ".", "parse", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/helpers/person.rb#L20-L30
valid
caruby/tissue
lib/catissue/database/controlled_values.rb
CaTissue.ControlledValues.find
def find(public_id_or_alias, value, recursive=false) pid = ControlledValue.standard_public_id(public_id_or_alias) value_cv_hash = @pid_value_cv_hash[pid] cv = value_cv_hash[value] if recursive then fetch_descendants(cv, value_cv_hash) end cv end
ruby
def find(public_id_or_alias, value, recursive=false) pid = ControlledValue.standard_public_id(public_id_or_alias) value_cv_hash = @pid_value_cv_hash[pid] cv = value_cv_hash[value] if recursive then fetch_descendants(cv, value_cv_hash) end cv end
[ "def", "find", "(", "public_id_or_alias", ",", "value", ",", "recursive", "=", "false", ")", "pid", "=", "ControlledValue", ".", "standard_public_id", "(", "public_id_or_alias", ")", "value_cv_hash", "=", "@pid_value_cv_hash", "[", "pid", "]", "cv", "=", "value_...
Returns the CV with the given public_id_or_alias and value. Loads the CV if necessary from the database. The loaded CV does not have a parent or children. @param [String, Symbol] public_id_or_alias the caTissue public id or alias @param [String] value the CV value @param [Boolean] recursive whether to load the CV ...
[ "Returns", "the", "CV", "with", "the", "given", "public_id_or_alias", "and", "value", ".", "Loads", "the", "CV", "if", "necessary", "from", "the", "database", ".", "The", "loaded", "CV", "does", "not", "have", "a", "parent", "or", "children", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/database/controlled_values.rb#L48-L56
valid
caruby/tissue
lib/catissue/database/controlled_values.rb
CaTissue.ControlledValues.create
def create(cv) if cv.public_id.nil? then raise ArgumentError.new("Controlled value create is missing a public id") end if cv.value.nil? then raise ArgumentError.new("Controlled value create is missing a value") end cv.identifier ||= next_id logger.debug { "Creating co...
ruby
def create(cv) if cv.public_id.nil? then raise ArgumentError.new("Controlled value create is missing a public id") end if cv.value.nil? then raise ArgumentError.new("Controlled value create is missing a value") end cv.identifier ||= next_id logger.debug { "Creating co...
[ "def", "create", "(", "cv", ")", "if", "cv", ".", "public_id", ".", "nil?", "then", "raise", "ArgumentError", ".", "new", "(", "\"Controlled value create is missing a public id\"", ")", "end", "if", "cv", ".", "value", ".", "nil?", "then", "raise", "ArgumentEr...
Creates a new controlled value record in the database from the given ControlledValue cv. The default identifier is the next identifier in the permissible values table. @param [ControlledValue] cv the controlled value to create @return [ControlledValue] the created CV
[ "Creates", "a", "new", "controlled", "value", "record", "in", "the", "database", "from", "the", "given", "ControlledValue", "cv", ".", "The", "default", "identifier", "is", "the", "next", "identifier", "in", "the", "permissible", "values", "table", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/database/controlled_values.rb#L63-L75
valid
caruby/tissue
lib/catissue/database/controlled_values.rb
CaTissue.ControlledValues.delete
def delete(cv) @executor.transact do |dbh| sth = dbh.prepare(DELETE_STMT) delete_recursive(cv, sth) sth.finish end end
ruby
def delete(cv) @executor.transact do |dbh| sth = dbh.prepare(DELETE_STMT) delete_recursive(cv, sth) sth.finish end end
[ "def", "delete", "(", "cv", ")", "@executor", ".", "transact", "do", "|", "dbh", "|", "sth", "=", "dbh", ".", "prepare", "(", "DELETE_STMT", ")", "delete_recursive", "(", "cv", ",", "sth", ")", "sth", ".", "finish", "end", "end" ]
Deletes the given ControlledValue record in the database. Recursively deletes the transitive closure of children as well. @param [ControlledValue] cv the controlled value to delete
[ "Deletes", "the", "given", "ControlledValue", "record", "in", "the", "database", ".", "Recursively", "deletes", "the", "transitive", "closure", "of", "children", "as", "well", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/database/controlled_values.rb#L81-L87
valid
caruby/tissue
lib/catissue/database/controlled_values.rb
CaTissue.ControlledValues.make_controlled_value
def make_controlled_value(value_hash) cv = ControlledValue.new(value_hash[:value], value_hash[:parent]) cv.identifier = value_hash[:identifier] cv.public_id = value_hash[:public_id] cv end
ruby
def make_controlled_value(value_hash) cv = ControlledValue.new(value_hash[:value], value_hash[:parent]) cv.identifier = value_hash[:identifier] cv.public_id = value_hash[:public_id] cv end
[ "def", "make_controlled_value", "(", "value_hash", ")", "cv", "=", "ControlledValue", ".", "new", "(", "value_hash", "[", ":value", "]", ",", "value_hash", "[", ":parent", "]", ")", "cv", ".", "identifier", "=", "value_hash", "[", ":identifier", "]", "cv", ...
Returns a new ControlledValue with attributes set by the given attribute => value hash.
[ "Returns", "a", "new", "ControlledValue", "with", "attributes", "set", "by", "the", "given", "attribute", "=", ">", "value", "hash", "." ]
08d99aabf4801c89842ce6dee138ccb1e4f5f56b
https://github.com/caruby/tissue/blob/08d99aabf4801c89842ce6dee138ccb1e4f5f56b/lib/catissue/database/controlled_values.rb#L174-L179
valid
nbaum/blower
lib/blower/context.rb
Blower.Context.with
def with (hash, quiet: false) old_values = data.values_at(hash.keys) log.debug "with #{hash}", quiet: quiet do set hash yield end ensure hash.keys.each.with_index do |key, i| @data[key] = old_values[i] end end
ruby
def with (hash, quiet: false) old_values = data.values_at(hash.keys) log.debug "with #{hash}", quiet: quiet do set hash yield end ensure hash.keys.each.with_index do |key, i| @data[key] = old_values[i] end end
[ "def", "with", "(", "hash", ",", "quiet", ":", "false", ")", "old_values", "=", "data", ".", "values_at", "(", "hash", ".", "keys", ")", "log", ".", "debug", "\"with #{hash}\"", ",", "quiet", ":", "quiet", "do", "set", "hash", "yield", "end", "ensure",...
Yield with the hash temporary merged into the context variables. Only variables specifically named in +hash+ will be reset when the yield returns. @param [Hash] hash The values to merge into the context variables. @return Whatever the yielded-to block returns. @macro quietable
[ "Yield", "with", "the", "hash", "temporary", "merged", "into", "the", "context", "variables", ".", "Only", "variables", "specifically", "named", "in", "+", "hash", "+", "will", "be", "reset", "when", "the", "yield", "returns", "." ]
9e09a56f9d4bf547bf1aa1843d894be625a27628
https://github.com/nbaum/blower/blob/9e09a56f9d4bf547bf1aa1843d894be625a27628/lib/blower/context.rb#L75-L85
valid
nbaum/blower
lib/blower/context.rb
Blower.Context.on
def on (*hosts, quiet: false) let :@hosts => hosts.flatten do log.info "on #{@hosts.map(&:name).join(", ")}", quiet: quiet do yield end end end
ruby
def on (*hosts, quiet: false) let :@hosts => hosts.flatten do log.info "on #{@hosts.map(&:name).join(", ")}", quiet: quiet do yield end end end
[ "def", "on", "(", "*", "hosts", ",", "quiet", ":", "false", ")", "let", ":@hosts", "=>", "hosts", ".", "flatten", "do", "log", ".", "info", "\"on #{@hosts.map(&:name).join(\", \")}\"", ",", "quiet", ":", "quiet", "do", "yield", "end", "end", "end" ]
Yield with a temporary host list @macro quietable
[ "Yield", "with", "a", "temporary", "host", "list" ]
9e09a56f9d4bf547bf1aa1843d894be625a27628
https://github.com/nbaum/blower/blob/9e09a56f9d4bf547bf1aa1843d894be625a27628/lib/blower/context.rb#L89-L95
valid
nbaum/blower
lib/blower/context.rb
Blower.Context.as
def as (user, quiet: false) let :@user => user do log.info "as #{user}", quiet: quiet do yield end end end
ruby
def as (user, quiet: false) let :@user => user do log.info "as #{user}", quiet: quiet do yield end end end
[ "def", "as", "(", "user", ",", "quiet", ":", "false", ")", "let", ":@user", "=>", "user", "do", "log", ".", "info", "\"as #{user}\"", ",", "quiet", ":", "quiet", "do", "yield", "end", "end", "end" ]
Yield with a temporary username override @macro quietable
[ "Yield", "with", "a", "temporary", "username", "override" ]
9e09a56f9d4bf547bf1aa1843d894be625a27628
https://github.com/nbaum/blower/blob/9e09a56f9d4bf547bf1aa1843d894be625a27628/lib/blower/context.rb#L99-L105
valid
nbaum/blower
lib/blower/context.rb
Blower.Context.sh
def sh (command, as: user, on: hosts, quiet: false, once: nil) self.once once, quiet: quiet do log.info "sh #{command}", quiet: quiet do hash_map(hosts) do |host| host.sh command, as: as, quiet: quiet end end end end
ruby
def sh (command, as: user, on: hosts, quiet: false, once: nil) self.once once, quiet: quiet do log.info "sh #{command}", quiet: quiet do hash_map(hosts) do |host| host.sh command, as: as, quiet: quiet end end end end
[ "def", "sh", "(", "command", ",", "as", ":", "user", ",", "on", ":", "hosts", ",", "quiet", ":", "false", ",", "once", ":", "nil", ")", "self", ".", "once", "once", ",", "quiet", ":", "quiet", "do", "log", ".", "info", "\"sh #{command}\"", ",", "...
Execute a shell command on each host @macro onable @macro asable @macro quietable @macro onceable
[ "Execute", "a", "shell", "command", "on", "each", "host" ]
9e09a56f9d4bf547bf1aa1843d894be625a27628
https://github.com/nbaum/blower/blob/9e09a56f9d4bf547bf1aa1843d894be625a27628/lib/blower/context.rb#L136-L144
valid
nbaum/blower
lib/blower/context.rb
Blower.Context.cp
def cp (from, to, as: user, on: hosts, quiet: false, once: nil) self.once once, quiet: quiet do log.info "cp: #{from} -> #{to}", quiet: quiet do Dir.chdir File.dirname(file) do hash_map(hosts) do |host| host.cp from, to, as: as, quiet: quiet end en...
ruby
def cp (from, to, as: user, on: hosts, quiet: false, once: nil) self.once once, quiet: quiet do log.info "cp: #{from} -> #{to}", quiet: quiet do Dir.chdir File.dirname(file) do hash_map(hosts) do |host| host.cp from, to, as: as, quiet: quiet end en...
[ "def", "cp", "(", "from", ",", "to", ",", "as", ":", "user", ",", "on", ":", "hosts", ",", "quiet", ":", "false", ",", "once", ":", "nil", ")", "self", ".", "once", "once", ",", "quiet", ":", "quiet", "do", "log", ".", "info", "\"cp: #{from} -> #...
Copy a file or readable to the host filesystems. @overload cp(readable, to, as: user, on: hosts, quiet: false) @param [#read] from An object from which to read the contents of the new file. @param [String] to The file name to write the string to. @macro onable @macro asable @macro quietable @macro on...
[ "Copy", "a", "file", "or", "readable", "to", "the", "host", "filesystems", "." ]
9e09a56f9d4bf547bf1aa1843d894be625a27628
https://github.com/nbaum/blower/blob/9e09a56f9d4bf547bf1aa1843d894be625a27628/lib/blower/context.rb#L161-L171
valid
nbaum/blower
lib/blower/context.rb
Blower.Context.read
def read (filename, as: user, on: hosts, quiet: false) log.info "read: #{filename}", quiet: quiet do hash_map(hosts) do |host| host.read filename, as: as end end end
ruby
def read (filename, as: user, on: hosts, quiet: false) log.info "read: #{filename}", quiet: quiet do hash_map(hosts) do |host| host.read filename, as: as end end end
[ "def", "read", "(", "filename", ",", "as", ":", "user", ",", "on", ":", "hosts", ",", "quiet", ":", "false", ")", "log", ".", "info", "\"read: #{filename}\"", ",", "quiet", ":", "quiet", "do", "hash_map", "(", "hosts", ")", "do", "|", "host", "|", ...
Reads a remote file from each host. @param [String] filename The file to read. @return [Hash] A hash of +Host+ objects to +Strings+ of the file contents. @macro onable @macro asable @macro quietable
[ "Reads", "a", "remote", "file", "from", "each", "host", "." ]
9e09a56f9d4bf547bf1aa1843d894be625a27628
https://github.com/nbaum/blower/blob/9e09a56f9d4bf547bf1aa1843d894be625a27628/lib/blower/context.rb#L179-L185
valid
nbaum/blower
lib/blower/context.rb
Blower.Context.write
def write (string, to, as: user, on: hosts, quiet: false, once: nil) self.once once, quiet: quiet do log.info "write: #{string.bytesize} bytes -> #{to}", quiet: quiet do hash_map(hosts) do |host| host.write string, to, as: as, quiet: quiet end end end end
ruby
def write (string, to, as: user, on: hosts, quiet: false, once: nil) self.once once, quiet: quiet do log.info "write: #{string.bytesize} bytes -> #{to}", quiet: quiet do hash_map(hosts) do |host| host.write string, to, as: as, quiet: quiet end end end end
[ "def", "write", "(", "string", ",", "to", ",", "as", ":", "user", ",", "on", ":", "hosts", ",", "quiet", ":", "false", ",", "once", ":", "nil", ")", "self", ".", "once", "once", ",", "quiet", ":", "quiet", "do", "log", ".", "info", "\"write: #{st...
Writes a string to a file on the host filesystems. @param [String] string The string to write. @param [String] to The file name to write the string to. @macro onable @macro asable @macro quietable @macro onceable
[ "Writes", "a", "string", "to", "a", "file", "on", "the", "host", "filesystems", "." ]
9e09a56f9d4bf547bf1aa1843d894be625a27628
https://github.com/nbaum/blower/blob/9e09a56f9d4bf547bf1aa1843d894be625a27628/lib/blower/context.rb#L194-L202
valid
nbaum/blower
lib/blower/context.rb
Blower.Context.ping
def ping (on: hosts, quiet: false) log.info "ping", quiet: quiet do hash_map(hosts) do |host| host.ping end end end
ruby
def ping (on: hosts, quiet: false) log.info "ping", quiet: quiet do hash_map(hosts) do |host| host.ping end end end
[ "def", "ping", "(", "on", ":", "hosts", ",", "quiet", ":", "false", ")", "log", ".", "info", "\"ping\"", ",", "quiet", ":", "quiet", "do", "hash_map", "(", "hosts", ")", "do", "|", "host", "|", "host", ".", "ping", "end", "end", "end" ]
Ping each host by trying to connect to port 22 @macro onable @macro quietable
[ "Ping", "each", "host", "by", "trying", "to", "connect", "to", "port", "22" ]
9e09a56f9d4bf547bf1aa1843d894be625a27628
https://github.com/nbaum/blower/blob/9e09a56f9d4bf547bf1aa1843d894be625a27628/lib/blower/context.rb#L231-L237
valid
nbaum/blower
lib/blower/context.rb
Blower.Context.once
def once (key, store: "/var/cache/blower.json", quiet: false) return yield unless key log.info "once: #{key}", quiet: quiet do hash_map(hosts) do |host| done = begin JSON.parse(host.read(store, quiet: true)) rescue => e {} end unless do...
ruby
def once (key, store: "/var/cache/blower.json", quiet: false) return yield unless key log.info "once: #{key}", quiet: quiet do hash_map(hosts) do |host| done = begin JSON.parse(host.read(store, quiet: true)) rescue => e {} end unless do...
[ "def", "once", "(", "key", ",", "store", ":", "\"/var/cache/blower.json\"", ",", "quiet", ":", "false", ")", "return", "yield", "unless", "key", "log", ".", "info", "\"once: #{key}\"", ",", "quiet", ":", "quiet", "do", "hash_map", "(", "hosts", ")", "do", ...
Execute a block only once per host. It is usually preferable to make tasks idempotent, but when that isn't possible, +once+ will only execute the block on hosts where a block with the same key hasn't previously been successfully executed. @param [String] key Uniquely identifies the block. @param [String] store Fil...
[ "Execute", "a", "block", "only", "once", "per", "host", ".", "It", "is", "usually", "preferable", "to", "make", "tasks", "idempotent", "but", "when", "that", "isn", "t", "possible", "+", "once", "+", "will", "only", "execute", "the", "block", "on", "host...
9e09a56f9d4bf547bf1aa1843d894be625a27628
https://github.com/nbaum/blower/blob/9e09a56f9d4bf547bf1aa1843d894be625a27628/lib/blower/context.rb#L246-L264
valid
obrie/turntabler
lib/turntabler/authorized_user.rb
Turntabler.AuthorizedUser.update
def update(attributes = {}) assert_valid_keys(attributes, :name, :status, :laptop_name, :twitter_id, :facebook_url, :website, :about, :top_artists, :hangout) # Update status status = attributes.delete(:status) update_status(status) if status # Update laptop laptop_name = attributes...
ruby
def update(attributes = {}) assert_valid_keys(attributes, :name, :status, :laptop_name, :twitter_id, :facebook_url, :website, :about, :top_artists, :hangout) # Update status status = attributes.delete(:status) update_status(status) if status # Update laptop laptop_name = attributes...
[ "def", "update", "(", "attributes", "=", "{", "}", ")", "assert_valid_keys", "(", "attributes", ",", ":name", ",", ":status", ",", ":laptop_name", ",", ":twitter_id", ",", ":facebook_url", ",", ":website", ",", ":about", ",", ":top_artists", ",", ":hangout", ...
Updates this user's profile information. @param [Hash] attributes The attributes to update @option attributes [String] :name @option attributes [String] :status Valid values include "available", "unavailable", and "away" @option attributes [String] :laptop_name Valid values include "mac", "pc", "linux", "chrome", ...
[ "Updates", "this", "user", "s", "profile", "information", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/authorized_user.rb#L130-L145
valid
obrie/turntabler
lib/turntabler/authorized_user.rb
Turntabler.AuthorizedUser.buddies
def buddies data = api('user.get_buddies') data['buddies'].map {|id| User.new(client, :_id => id)} end
ruby
def buddies data = api('user.get_buddies') data['buddies'].map {|id| User.new(client, :_id => id)} end
[ "def", "buddies", "data", "=", "api", "(", "'user.get_buddies'", ")", "data", "[", "'buddies'", "]", ".", "map", "{", "|", "id", "|", "User", ".", "new", "(", "client", ",", ":_id", "=>", "id", ")", "}", "end" ]
Loads the list of users that are connected to the current user through a social network like Facebook or Twitter. @return [Array<Turntabler::User>] @raise [Turntabler::Error] if the command fails @example user.buddies # => [#<Turntabler::User ...>, ...]
[ "Loads", "the", "list", "of", "users", "that", "are", "connected", "to", "the", "current", "user", "through", "a", "social", "network", "like", "Facebook", "or", "Twitter", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/authorized_user.rb#L154-L157
valid
obrie/turntabler
lib/turntabler/authorized_user.rb
Turntabler.AuthorizedUser.fan_of
def fan_of data = api('user.get_fan_of') data['fanof'].map {|id| User.new(client, :_id => id)} end
ruby
def fan_of data = api('user.get_fan_of') data['fanof'].map {|id| User.new(client, :_id => id)} end
[ "def", "fan_of", "data", "=", "api", "(", "'user.get_fan_of'", ")", "data", "[", "'fanof'", "]", ".", "map", "{", "|", "id", "|", "User", ".", "new", "(", "client", ",", ":_id", "=>", "id", ")", "}", "end" ]
Loads the list of users that the current user is a fan of. @return [Array<Turntabler::User>] @raise [Turntabler::Error] if the command fails @example user.fan_of # => [#<Turntabler::User ...>, ...]
[ "Loads", "the", "list", "of", "users", "that", "the", "current", "user", "is", "a", "fan", "of", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/authorized_user.rb#L165-L168
valid
obrie/turntabler
lib/turntabler/authorized_user.rb
Turntabler.AuthorizedUser.fans
def fans data = api('user.get_fans') data['fans'].map {|id| User.new(client, :_id => id)} end
ruby
def fans data = api('user.get_fans') data['fans'].map {|id| User.new(client, :_id => id)} end
[ "def", "fans", "data", "=", "api", "(", "'user.get_fans'", ")", "data", "[", "'fans'", "]", ".", "map", "{", "|", "id", "|", "User", ".", "new", "(", "client", ",", ":_id", "=>", "id", ")", "}", "end" ]
Loads the list of users that are a fan of the current user. @return [Array<Turntabler::User>] @raise [Turntabler::Error] if the command fails @example user.fans # => [#<Turntabler::User ...>, ...]
[ "Loads", "the", "list", "of", "users", "that", "are", "a", "fan", "of", "the", "current", "user", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/authorized_user.rb#L176-L179
valid
obrie/turntabler
lib/turntabler/authorized_user.rb
Turntabler.AuthorizedUser.stickers_purchased
def stickers_purchased data = api('sticker.get_purchased_stickers') data['stickers'].map {|sticker_id| Sticker.new(client, :_id => sticker_id)} end
ruby
def stickers_purchased data = api('sticker.get_purchased_stickers') data['stickers'].map {|sticker_id| Sticker.new(client, :_id => sticker_id)} end
[ "def", "stickers_purchased", "data", "=", "api", "(", "'sticker.get_purchased_stickers'", ")", "data", "[", "'stickers'", "]", ".", "map", "{", "|", "sticker_id", "|", "Sticker", ".", "new", "(", "client", ",", ":_id", "=>", "sticker_id", ")", "}", "end" ]
Gets the stickers that have been purchased by this user. @return [Array<Turntabler::Sticker>] @raise [Turntabler::Error] if the command fails @example user.stickers_purchased # => [#<Turntabler::Sticker ...>, ...]
[ "Gets", "the", "stickers", "that", "have", "been", "purchased", "by", "this", "user", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/authorized_user.rb#L209-L212
valid
obrie/turntabler
lib/turntabler/authorized_user.rb
Turntabler.AuthorizedUser.blocks
def blocks data = api('block.list_all') data['blocks'].map {|attrs| User.new(client, attrs['block']['blocked'])} end
ruby
def blocks data = api('block.list_all') data['blocks'].map {|attrs| User.new(client, attrs['block']['blocked'])} end
[ "def", "blocks", "data", "=", "api", "(", "'block.list_all'", ")", "data", "[", "'blocks'", "]", ".", "map", "{", "|", "attrs", "|", "User", ".", "new", "(", "client", ",", "attrs", "[", "'block'", "]", "[", "'blocked'", "]", ")", "}", "end" ]
Gets the users that have been blocked by this user. @return [Array<Turntabler::User>] @raise [Turntabler::Error] if the command fails @example user.blocks # => [#<Turntabler::User ...>, ...]
[ "Gets", "the", "users", "that", "have", "been", "blocked", "by", "this", "user", "." ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/authorized_user.rb#L220-L223
valid
obrie/turntabler
lib/turntabler/authorized_user.rb
Turntabler.AuthorizedUser.update_profile
def update_profile(attributes = {}) assert_valid_keys(attributes, :name, :twitter_id, :facebook_url, :website, :about, :top_artists, :hangout) # Convert attribute names over to their Turntable equivalent {:twitter_id => :twitter, :facebook_url => :facebook, :top_artists => :topartists}.each do |from,...
ruby
def update_profile(attributes = {}) assert_valid_keys(attributes, :name, :twitter_id, :facebook_url, :website, :about, :top_artists, :hangout) # Convert attribute names over to their Turntable equivalent {:twitter_id => :twitter, :facebook_url => :facebook, :top_artists => :topartists}.each do |from,...
[ "def", "update_profile", "(", "attributes", "=", "{", "}", ")", "assert_valid_keys", "(", "attributes", ",", ":name", ",", ":twitter_id", ",", ":facebook_url", ",", ":website", ",", ":about", ",", ":top_artists", ",", ":hangout", ")", "{", ":twitter_id", "=>",...
Updates the user's profile information
[ "Updates", "the", "user", "s", "profile", "information" ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/authorized_user.rb#L227-L238
valid
obrie/turntabler
lib/turntabler/authorized_user.rb
Turntabler.AuthorizedUser.update_laptop
def update_laptop(name) assert_valid_values(name, *%w(mac pc linux chrome iphone cake intel android)) api('user.modify', :laptop => name) self.attributes = {'laptop' => name} true end
ruby
def update_laptop(name) assert_valid_values(name, *%w(mac pc linux chrome iphone cake intel android)) api('user.modify', :laptop => name) self.attributes = {'laptop' => name} true end
[ "def", "update_laptop", "(", "name", ")", "assert_valid_values", "(", "name", ",", "*", "%w(", "mac", "pc", "linux", "chrome", "iphone", "cake", "intel", "android", ")", ")", "api", "(", "'user.modify'", ",", ":laptop", "=>", "name", ")", "self", ".", "a...
Updates the laptop currently being used
[ "Updates", "the", "laptop", "currently", "being", "used" ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/authorized_user.rb#L241-L247
valid
obrie/turntabler
lib/turntabler/authorized_user.rb
Turntabler.AuthorizedUser.update_status
def update_status(status = self.status) assert_valid_values(status, *%w(available unavailable away)) now = Time.now.to_i result = api('presence.update', :status => status) client.reset_keepalive(result['interval']) client.clock_delta = ((now + Time.now.to_i) / 2 - result['now']).round ...
ruby
def update_status(status = self.status) assert_valid_values(status, *%w(available unavailable away)) now = Time.now.to_i result = api('presence.update', :status => status) client.reset_keepalive(result['interval']) client.clock_delta = ((now + Time.now.to_i) / 2 - result['now']).round ...
[ "def", "update_status", "(", "status", "=", "self", ".", "status", ")", "assert_valid_values", "(", "status", ",", "*", "%w(", "available", "unavailable", "away", ")", ")", "now", "=", "Time", ".", "now", ".", "to_i", "result", "=", "api", "(", "'presenc...
Sets the user's current status
[ "Sets", "the", "user", "s", "current", "status" ]
e2240f1a5d210a33c05c5b2261d291089cdcf1c6
https://github.com/obrie/turntabler/blob/e2240f1a5d210a33c05c5b2261d291089cdcf1c6/lib/turntabler/authorized_user.rb#L250-L261
valid