id int32 0 24.9k | repo stringlengths 5 58 | path stringlengths 9 168 | func_name stringlengths 9 130 | original_string stringlengths 66 10.5k | language stringclasses 1
value | code stringlengths 66 10.5k | code_tokens list | docstring stringlengths 8 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 94 266 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1,600 | mynameisrufus/sorted | lib/sorted/set.rb | Sorted.Set.c | def c(memo)
each do |order|
unless memo.keys.include?(order[0])
memo << order
end
end
end | ruby | def c(memo)
each do |order|
unless memo.keys.include?(order[0])
memo << order
end
end
end | [
"def",
"c",
"(",
"memo",
")",
"each",
"do",
"|",
"order",
"|",
"unless",
"memo",
".",
"keys",
".",
"include?",
"(",
"order",
"[",
"0",
"]",
")",
"memo",
"<<",
"order",
"end",
"end",
"end"
] | Add items not in memo | [
"Add",
"items",
"not",
"in",
"memo"
] | 6490682f7970e27b692ff0c931f04cf86a52ec0a | https://github.com/mynameisrufus/sorted/blob/6490682f7970e27b692ff0c931f04cf86a52ec0a/lib/sorted/set.rb#L214-L220 |
1,601 | mynameisrufus/sorted | lib/sorted/set.rb | Sorted.Set.d | def d(memo, other)
other.each do |sort|
unless memo.keys.include?(sort[0])
memo << sort
end
end
end | ruby | def d(memo, other)
other.each do |sort|
unless memo.keys.include?(sort[0])
memo << sort
end
end
end | [
"def",
"d",
"(",
"memo",
",",
"other",
")",
"other",
".",
"each",
"do",
"|",
"sort",
"|",
"unless",
"memo",
".",
"keys",
".",
"include?",
"(",
"sort",
"[",
"0",
"]",
")",
"memo",
"<<",
"sort",
"end",
"end",
"end"
] | Add items from other not in memo | [
"Add",
"items",
"from",
"other",
"not",
"in",
"memo"
] | 6490682f7970e27b692ff0c931f04cf86a52ec0a | https://github.com/mynameisrufus/sorted/blob/6490682f7970e27b692ff0c931f04cf86a52ec0a/lib/sorted/set.rb#L223-L229 |
1,602 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.list_triggers | def list_triggers(ids = [], tags = [])
query = generate_query_params 'triggerIds' => ids, 'tags' => tags
sub_url = '/triggers' + query
ret = http_get(sub_url)
val = []
ret.each { |t| val.push(Trigger.new(t)) }
val
end | ruby | def list_triggers(ids = [], tags = [])
query = generate_query_params 'triggerIds' => ids, 'tags' => tags
sub_url = '/triggers' + query
ret = http_get(sub_url)
val = []
ret.each { |t| val.push(Trigger.new(t)) }
val
end | [
"def",
"list_triggers",
"(",
"ids",
"=",
"[",
"]",
",",
"tags",
"=",
"[",
"]",
")",
"query",
"=",
"generate_query_params",
"'triggerIds'",
"=>",
"ids",
",",
"'tags'",
"=>",
"tags",
"sub_url",
"=",
"'/triggers'",
"+",
"query",
"ret",
"=",
"http_get",
"(",... | Lists defined triggers in the system
@param [Array] ids List of trigger ids. If provided, limits to the given triggers
@param [Array] tags List of tags. If provided, limits to the given tags. Individual
tags are of the format # key|value. Tags are OR'd together. If a tag-key shows up
more than once, only the last o... | [
"Lists",
"defined",
"triggers",
"in",
"the",
"system"
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L37-L46 |
1,603 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.get_single_trigger | def get_single_trigger(trigger_id, full = false)
the_trigger = '/triggers/' + trigger_id
ret = http_get(the_trigger)
trigger = Trigger.new(ret)
if full
ret = http_get(the_trigger + '/conditions')
ret.each { |c| trigger.conditions.push(Trigger::Condition.new(c)) }
ret = h... | ruby | def get_single_trigger(trigger_id, full = false)
the_trigger = '/triggers/' + trigger_id
ret = http_get(the_trigger)
trigger = Trigger.new(ret)
if full
ret = http_get(the_trigger + '/conditions')
ret.each { |c| trigger.conditions.push(Trigger::Condition.new(c)) }
ret = h... | [
"def",
"get_single_trigger",
"(",
"trigger_id",
",",
"full",
"=",
"false",
")",
"the_trigger",
"=",
"'/triggers/'",
"+",
"trigger_id",
"ret",
"=",
"http_get",
"(",
"the_trigger",
")",
"trigger",
"=",
"Trigger",
".",
"new",
"(",
"ret",
")",
"if",
"full",
"r... | Obtains one Trigger definition from the server.
@param [String] trigger_id Id of the trigger to fetch
@param full If true then conditions and dampenings for the trigger are also fetched
@return [Trigger] the selected trigger | [
"Obtains",
"one",
"Trigger",
"definition",
"from",
"the",
"server",
"."
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L52-L65 |
1,604 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.create_trigger | def create_trigger(trigger, conditions = [], dampenings = [], _actions = [])
full_trigger = {}
full_trigger[:trigger] = trigger.to_h
conds = []
conditions.each { |c| conds.push(c.to_h) }
full_trigger[:conditions] = conds
damps = []
dampenings.each { |d| damps.push(d.to_h) } unl... | ruby | def create_trigger(trigger, conditions = [], dampenings = [], _actions = [])
full_trigger = {}
full_trigger[:trigger] = trigger.to_h
conds = []
conditions.each { |c| conds.push(c.to_h) }
full_trigger[:conditions] = conds
damps = []
dampenings.each { |d| damps.push(d.to_h) } unl... | [
"def",
"create_trigger",
"(",
"trigger",
",",
"conditions",
"=",
"[",
"]",
",",
"dampenings",
"=",
"[",
"]",
",",
"_actions",
"=",
"[",
"]",
")",
"full_trigger",
"=",
"{",
"}",
"full_trigger",
"[",
":trigger",
"]",
"=",
"trigger",
".",
"to_h",
"conds",... | Creates the trigger definition.
@param [Trigger] trigger The trigger to be created
@param [Array<Condition>] conditions Array of associated conditions
@param [Array<Dampening>] dampenings Array of associated dampenings
@return [Trigger] The newly created trigger | [
"Creates",
"the",
"trigger",
"definition",
"."
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L80-L91 |
1,605 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.set_group_conditions | def set_group_conditions(trigger_id, trigger_mode, group_conditions_info)
ret = http_put "triggers/groups/#{trigger_id}/conditions/#{trigger_mode}", group_conditions_info.to_h
conditions = []
ret.each { |c| conditions.push(Trigger::Condition.new(c)) }
conditions
end | ruby | def set_group_conditions(trigger_id, trigger_mode, group_conditions_info)
ret = http_put "triggers/groups/#{trigger_id}/conditions/#{trigger_mode}", group_conditions_info.to_h
conditions = []
ret.each { |c| conditions.push(Trigger::Condition.new(c)) }
conditions
end | [
"def",
"set_group_conditions",
"(",
"trigger_id",
",",
"trigger_mode",
",",
"group_conditions_info",
")",
"ret",
"=",
"http_put",
"\"triggers/groups/#{trigger_id}/conditions/#{trigger_mode}\"",
",",
"group_conditions_info",
".",
"to_h",
"conditions",
"=",
"[",
"]",
"ret",
... | Creates the group conditions definitions.
@param [String] trigger_id ID of the group trigger to set conditions
@param [String] trigger_mode Mode of the trigger where conditions are attached (:FIRING, :AUTORESOLVE)
@param [GroupConditionsInfo] group_conditions_info the conditions to set into the group trigger with th... | [
"Creates",
"the",
"group",
"conditions",
"definitions",
"."
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L115-L120 |
1,606 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.list_members | def list_members(trigger_id, orphans = false)
ret = http_get "triggers/groups/#{trigger_id}/members?includeOrphans=#{orphans}"
ret.collect { |t| Trigger.new(t) }
end | ruby | def list_members(trigger_id, orphans = false)
ret = http_get "triggers/groups/#{trigger_id}/members?includeOrphans=#{orphans}"
ret.collect { |t| Trigger.new(t) }
end | [
"def",
"list_members",
"(",
"trigger_id",
",",
"orphans",
"=",
"false",
")",
"ret",
"=",
"http_get",
"\"triggers/groups/#{trigger_id}/members?includeOrphans=#{orphans}\"",
"ret",
".",
"collect",
"{",
"|",
"t",
"|",
"Trigger",
".",
"new",
"(",
"t",
")",
"}",
"end... | Lists members of a group trigger
@param [String] trigger_id ID of the group trigger to list members
@param [boolean] orphans flag to include orphans
@return [Array<Trigger>] Members found | [
"Lists",
"members",
"of",
"a",
"group",
"trigger"
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L142-L145 |
1,607 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.create_group_dampening | def create_group_dampening(dampening)
ret = http_post "triggers/groups/#{dampening.trigger_id}/dampenings", dampening.to_h
Trigger::Dampening.new(ret)
end | ruby | def create_group_dampening(dampening)
ret = http_post "triggers/groups/#{dampening.trigger_id}/dampenings", dampening.to_h
Trigger::Dampening.new(ret)
end | [
"def",
"create_group_dampening",
"(",
"dampening",
")",
"ret",
"=",
"http_post",
"\"triggers/groups/#{dampening.trigger_id}/dampenings\"",
",",
"dampening",
".",
"to_h",
"Trigger",
"::",
"Dampening",
".",
"new",
"(",
"ret",
")",
"end"
] | Creates a dampening for a group trigger
@param [Dampening] dampening the dampening to create
@return [Dampening] the newly created dampening | [
"Creates",
"a",
"dampening",
"for",
"a",
"group",
"trigger"
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L150-L153 |
1,608 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.update_group_dampening | def update_group_dampening(dampening)
ret = http_put "triggers/groups/#{dampening.trigger_id}/dampenings/#{dampening.dampening_id}", dampening.to_h
Trigger::Dampening.new(ret)
end | ruby | def update_group_dampening(dampening)
ret = http_put "triggers/groups/#{dampening.trigger_id}/dampenings/#{dampening.dampening_id}", dampening.to_h
Trigger::Dampening.new(ret)
end | [
"def",
"update_group_dampening",
"(",
"dampening",
")",
"ret",
"=",
"http_put",
"\"triggers/groups/#{dampening.trigger_id}/dampenings/#{dampening.dampening_id}\"",
",",
"dampening",
".",
"to_h",
"Trigger",
"::",
"Dampening",
".",
"new",
"(",
"ret",
")",
"end"
] | Updates a dampening for a group trigger
@param [Dampening] dampening the dampening to update
@return [Dampening] the updated dampening | [
"Updates",
"a",
"dampening",
"for",
"a",
"group",
"trigger"
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L158-L161 |
1,609 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.create_action | def create_action(plugin, action_id, properties = {})
the_plugin = hawk_escape plugin
# Check if plugin exists
http_get("/plugins/#{the_plugin}")
payload = { actionId: action_id, actionPlugin: plugin, properties: properties }
ret = http_post('/actions', payload)
Trigger::Action.new(... | ruby | def create_action(plugin, action_id, properties = {})
the_plugin = hawk_escape plugin
# Check if plugin exists
http_get("/plugins/#{the_plugin}")
payload = { actionId: action_id, actionPlugin: plugin, properties: properties }
ret = http_post('/actions', payload)
Trigger::Action.new(... | [
"def",
"create_action",
"(",
"plugin",
",",
"action_id",
",",
"properties",
"=",
"{",
"}",
")",
"the_plugin",
"=",
"hawk_escape",
"plugin",
"# Check if plugin exists",
"http_get",
"(",
"\"/plugins/#{the_plugin}\"",
")",
"payload",
"=",
"{",
"actionId",
":",
"actio... | Creates the action.
@param [String] plugin The id of action definition/plugin
@param [String] action_id The id of action
@param [Hash] properties Troperties of action
@return [Action] The newly created action | [
"Creates",
"the",
"action",
"."
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L198-L206 |
1,610 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.get_action | def get_action(plugin, action_id)
the_plugin = hawk_escape plugin
the_action_id = hawk_escape action_id
ret = http_get "/actions/#{the_plugin}/#{the_action_id}"
Trigger::Action.new(ret)
end | ruby | def get_action(plugin, action_id)
the_plugin = hawk_escape plugin
the_action_id = hawk_escape action_id
ret = http_get "/actions/#{the_plugin}/#{the_action_id}"
Trigger::Action.new(ret)
end | [
"def",
"get_action",
"(",
"plugin",
",",
"action_id",
")",
"the_plugin",
"=",
"hawk_escape",
"plugin",
"the_action_id",
"=",
"hawk_escape",
"action_id",
"ret",
"=",
"http_get",
"\"/actions/#{the_plugin}/#{the_action_id}\"",
"Trigger",
"::",
"Action",
".",
"new",
"(",
... | Obtains one action of given action plugin from the server.
@param [String] plugin Id of the action plugin
@param [String] action_id Id of the action
@return [Action] the selected trigger | [
"Obtains",
"one",
"action",
"of",
"given",
"action",
"plugin",
"from",
"the",
"server",
"."
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L212-L217 |
1,611 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.delete_action | def delete_action(plugin, action_id)
the_plugin = hawk_escape plugin
the_action_id = hawk_escape action_id
http_delete "/actions/#{the_plugin}/#{the_action_id}"
end | ruby | def delete_action(plugin, action_id)
the_plugin = hawk_escape plugin
the_action_id = hawk_escape action_id
http_delete "/actions/#{the_plugin}/#{the_action_id}"
end | [
"def",
"delete_action",
"(",
"plugin",
",",
"action_id",
")",
"the_plugin",
"=",
"hawk_escape",
"plugin",
"the_action_id",
"=",
"hawk_escape",
"action_id",
"http_delete",
"\"/actions/#{the_plugin}/#{the_action_id}\"",
"end"
] | Deletes the action of given action plugin.
@param [String] plugin Id of the action plugin
@param [String] action_id Id of the action | [
"Deletes",
"the",
"action",
"of",
"given",
"action",
"plugin",
"."
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L222-L226 |
1,612 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.get_alerts_for_trigger | def get_alerts_for_trigger(trigger_id)
# TODO: add additional filters
return [] unless trigger_id
url = '/?triggerIds=' + trigger_id
ret = http_get(url)
val = []
ret.each { |a| val.push(Alert.new(a)) }
val
end | ruby | def get_alerts_for_trigger(trigger_id)
# TODO: add additional filters
return [] unless trigger_id
url = '/?triggerIds=' + trigger_id
ret = http_get(url)
val = []
ret.each { |a| val.push(Alert.new(a)) }
val
end | [
"def",
"get_alerts_for_trigger",
"(",
"trigger_id",
")",
"# TODO: add additional filters",
"return",
"[",
"]",
"unless",
"trigger_id",
"url",
"=",
"'/?triggerIds='",
"+",
"trigger_id",
"ret",
"=",
"http_get",
"(",
"url",
")",
"val",
"=",
"[",
"]",
"ret",
".",
... | Obtain the alerts for the Trigger with the passed id
@param [String] trigger_id Id of the trigger that has fired the alerts
@return [Array<Alert>] List of alerts for the trigger. Can be empty | [
"Obtain",
"the",
"alerts",
"for",
"the",
"Trigger",
"with",
"the",
"passed",
"id"
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L231-L240 |
1,613 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.alerts | def alerts(criteria: {}, tenants: nil)
query = generate_query_params(criteria)
uri = tenants ? '/admin/alerts/' : '/'
ret = http_get(uri + query, multi_tenants_header(tenants))
val = []
ret.each { |a| val.push(Alert.new(a)) }
val
end | ruby | def alerts(criteria: {}, tenants: nil)
query = generate_query_params(criteria)
uri = tenants ? '/admin/alerts/' : '/'
ret = http_get(uri + query, multi_tenants_header(tenants))
val = []
ret.each { |a| val.push(Alert.new(a)) }
val
end | [
"def",
"alerts",
"(",
"criteria",
":",
"{",
"}",
",",
"tenants",
":",
"nil",
")",
"query",
"=",
"generate_query_params",
"(",
"criteria",
")",
"uri",
"=",
"tenants",
"?",
"'/admin/alerts/'",
":",
"'/'",
"ret",
"=",
"http_get",
"(",
"uri",
"+",
"query",
... | List fired alerts
@param [Hash] criteria optional query criteria
@param [Array] tenants optional list of tenants. The elements of the array can be any object
convertible to a string
@return [Array<Alert>] List of alerts in the system. Can be empty | [
"List",
"fired",
"alerts"
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L254-L261 |
1,614 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.get_single_alert | def get_single_alert(alert_id)
ret = http_get('/alert/' + alert_id)
val = Alert.new(ret)
val
end | ruby | def get_single_alert(alert_id)
ret = http_get('/alert/' + alert_id)
val = Alert.new(ret)
val
end | [
"def",
"get_single_alert",
"(",
"alert_id",
")",
"ret",
"=",
"http_get",
"(",
"'/alert/'",
"+",
"alert_id",
")",
"val",
"=",
"Alert",
".",
"new",
"(",
"ret",
")",
"val",
"end"
] | Retrieve a single Alert by its id
@param [String] alert_id id of the alert to fetch
@return [Alert] Alert object retrieved | [
"Retrieve",
"a",
"single",
"Alert",
"by",
"its",
"id"
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L266-L270 |
1,615 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.resolve_alert | def resolve_alert(alert_id, by = nil, comment = nil)
sub_url = "/resolve/#{alert_id}"
query = generate_query_params 'resolvedBy' => by, 'resolvedNotes' => comment
sub_url += query
http_put(sub_url, {})
true
end | ruby | def resolve_alert(alert_id, by = nil, comment = nil)
sub_url = "/resolve/#{alert_id}"
query = generate_query_params 'resolvedBy' => by, 'resolvedNotes' => comment
sub_url += query
http_put(sub_url, {})
true
end | [
"def",
"resolve_alert",
"(",
"alert_id",
",",
"by",
"=",
"nil",
",",
"comment",
"=",
"nil",
")",
"sub_url",
"=",
"\"/resolve/#{alert_id}\"",
"query",
"=",
"generate_query_params",
"'resolvedBy'",
"=>",
"by",
",",
"'resolvedNotes'",
"=>",
"comment",
"sub_url",
"+... | Mark one alert as resolved
@param [String] alert_id Id of the alert to resolve
@param [String] by name of the user resolving the alert
@param [String] comment A comment on the resolution | [
"Mark",
"one",
"alert",
"as",
"resolved"
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L276-L283 |
1,616 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.create_event | def create_event(id, category, text, extras)
event = {}
event['id'] = id
event['ctime'] = Time.now.to_i * 1000
event['category'] = category
event['text'] = text
event.merge!(extras) { |_key, v1, _v2| v1 }
http_post('/events', event)
end | ruby | def create_event(id, category, text, extras)
event = {}
event['id'] = id
event['ctime'] = Time.now.to_i * 1000
event['category'] = category
event['text'] = text
event.merge!(extras) { |_key, v1, _v2| v1 }
http_post('/events', event)
end | [
"def",
"create_event",
"(",
"id",
",",
"category",
",",
"text",
",",
"extras",
")",
"event",
"=",
"{",
"}",
"event",
"[",
"'id'",
"]",
"=",
"id",
"event",
"[",
"'ctime'",
"]",
"=",
"Time",
".",
"now",
".",
"to_i",
"*",
"1000",
"event",
"[",
"'cat... | Inject an event into Hawkular-alerts
@param [String] id Id of the event must be unique
@param [String] category Event category for further distinction
@param [String] text Some text to the user
@param [Hash<String,Object>] extras additional parameters | [
"Inject",
"an",
"event",
"into",
"Hawkular",
"-",
"alerts"
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L335-L344 |
1,617 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.add_tags | def add_tags(alert_ids, tags)
query = generate_query_params(alertIds: alert_ids, tags: tags)
http_put('/tags' + query, {})
end | ruby | def add_tags(alert_ids, tags)
query = generate_query_params(alertIds: alert_ids, tags: tags)
http_put('/tags' + query, {})
end | [
"def",
"add_tags",
"(",
"alert_ids",
",",
"tags",
")",
"query",
"=",
"generate_query_params",
"(",
"alertIds",
":",
"alert_ids",
",",
"tags",
":",
"tags",
")",
"http_put",
"(",
"'/tags'",
"+",
"query",
",",
"{",
"}",
")",
"end"
] | Add tags to existing Alerts.
@param [Array<numeric>] alert_ids List of alert IDs
@param [Array<String>] tags List of tags. Each tag of format 'name|value'. | [
"Add",
"tags",
"to",
"existing",
"Alerts",
"."
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L353-L356 |
1,618 | hawkular/hawkular-client-ruby | lib/hawkular/alerts/alerts_api.rb | Hawkular::Alerts.Client.remove_tags | def remove_tags(alert_ids, tag_names)
query = generate_query_params(alertIds: alert_ids, tagNames: tag_names)
http_delete('/tags' + query)
end | ruby | def remove_tags(alert_ids, tag_names)
query = generate_query_params(alertIds: alert_ids, tagNames: tag_names)
http_delete('/tags' + query)
end | [
"def",
"remove_tags",
"(",
"alert_ids",
",",
"tag_names",
")",
"query",
"=",
"generate_query_params",
"(",
"alertIds",
":",
"alert_ids",
",",
"tagNames",
":",
"tag_names",
")",
"http_delete",
"(",
"'/tags'",
"+",
"query",
")",
"end"
] | Remove tags from existing Alerts.
@param [Array<numeric>] alert_ids List of alert IDs
@param [Array<String>] tag_names List of tag names. | [
"Remove",
"tags",
"from",
"existing",
"Alerts",
"."
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/alerts/alerts_api.rb#L361-L364 |
1,619 | paddor/cztop | lib/cztop/cert_store.rb | CZTop.CertStore.lookup | def lookup(pubkey)
ptr = ffi_delegate.lookup(pubkey)
return nil if ptr.null?
Certificate.from_ffi_delegate(ptr)
end | ruby | def lookup(pubkey)
ptr = ffi_delegate.lookup(pubkey)
return nil if ptr.null?
Certificate.from_ffi_delegate(ptr)
end | [
"def",
"lookup",
"(",
"pubkey",
")",
"ptr",
"=",
"ffi_delegate",
".",
"lookup",
"(",
"pubkey",
")",
"return",
"nil",
"if",
"ptr",
".",
"null?",
"Certificate",
".",
"from_ffi_delegate",
"(",
"ptr",
")",
"end"
] | Initializes a new certificate store.
@param location [String, #to_s, nil] location the path to the
directories to load certificates from, or nil if no certificates need
to be loaded from the disk
Looks up a certificate in the store by its public key.
@param pubkey [String] the public key in question, in Z85 ... | [
"Initializes",
"a",
"new",
"certificate",
"store",
"."
] | d20ee44775d05b60f40fffd1287a9b01270ab853 | https://github.com/paddor/cztop/blob/d20ee44775d05b60f40fffd1287a9b01270ab853/lib/cztop/cert_store.rb#L29-L33 |
1,620 | paddor/cztop | lib/cztop/cert_store.rb | CZTop.CertStore.insert | def insert(cert)
raise ArgumentError unless cert.is_a?(Certificate)
@_inserted_pubkeys ||= Set.new
pubkey = cert.public_key
raise ArgumentError if @_inserted_pubkeys.include? pubkey
ffi_delegate.insert(cert.ffi_delegate)
@_inserted_pubkeys << pubkey
end | ruby | def insert(cert)
raise ArgumentError unless cert.is_a?(Certificate)
@_inserted_pubkeys ||= Set.new
pubkey = cert.public_key
raise ArgumentError if @_inserted_pubkeys.include? pubkey
ffi_delegate.insert(cert.ffi_delegate)
@_inserted_pubkeys << pubkey
end | [
"def",
"insert",
"(",
"cert",
")",
"raise",
"ArgumentError",
"unless",
"cert",
".",
"is_a?",
"(",
"Certificate",
")",
"@_inserted_pubkeys",
"||=",
"Set",
".",
"new",
"pubkey",
"=",
"cert",
".",
"public_key",
"raise",
"ArgumentError",
"if",
"@_inserted_pubkeys",
... | Inserts a new certificate into the store.
@note The same public key must not be inserted more than once.
@param cert [Certificate] the certificate to insert
@return [void]
@raise [ArgumentError] if the given certificate is not a Certificate
object or has been inserted before already | [
"Inserts",
"a",
"new",
"certificate",
"into",
"the",
"store",
"."
] | d20ee44775d05b60f40fffd1287a9b01270ab853 | https://github.com/paddor/cztop/blob/d20ee44775d05b60f40fffd1287a9b01270ab853/lib/cztop/cert_store.rb#L42-L51 |
1,621 | apotonick/declarative | lib/declarative/heritage.rb | Declarative.Heritage.record | def record(method, *args, &block)
self << {method: method, args: DeepDup.(args), block: block} # DISCUSS: options.dup.
end | ruby | def record(method, *args, &block)
self << {method: method, args: DeepDup.(args), block: block} # DISCUSS: options.dup.
end | [
"def",
"record",
"(",
"method",
",",
"*",
"args",
",",
"&",
"block",
")",
"self",
"<<",
"{",
"method",
":",
"method",
",",
"args",
":",
"DeepDup",
".",
"(",
"args",
")",
",",
"block",
":",
"block",
"}",
"# DISCUSS: options.dup.",
"end"
] | Record inheritable assignments for replay in an inheriting class. | [
"Record",
"inheritable",
"assignments",
"for",
"replay",
"in",
"an",
"inheriting",
"class",
"."
] | 927ecf53fd9b94b85be29a5a0bab115057ecee9b | https://github.com/apotonick/declarative/blob/927ecf53fd9b94b85be29a5a0bab115057ecee9b/lib/declarative/heritage.rb#L6-L8 |
1,622 | flori/protocol | lib/protocol/utilities.rb | Protocol.Utilities.find_method_module | def find_method_module(methodname, ancestors)
methodname = methodname.to_s
ancestors.each do |a|
begin
a.instance_method(methodname)
return a
rescue NameError
end
end
nil
end | ruby | def find_method_module(methodname, ancestors)
methodname = methodname.to_s
ancestors.each do |a|
begin
a.instance_method(methodname)
return a
rescue NameError
end
end
nil
end | [
"def",
"find_method_module",
"(",
"methodname",
",",
"ancestors",
")",
"methodname",
"=",
"methodname",
".",
"to_s",
"ancestors",
".",
"each",
"do",
"|",
"a",
"|",
"begin",
"a",
".",
"instance_method",
"(",
"methodname",
")",
"return",
"a",
"rescue",
"NameEr... | This Method tries to find the first module that implements the method
named +methodname+ in the array of +ancestors+. If this fails nil is
returned. | [
"This",
"Method",
"tries",
"to",
"find",
"the",
"first",
"module",
"that",
"implements",
"the",
"method",
"named",
"+",
"methodname",
"+",
"in",
"the",
"array",
"of",
"+",
"ancestors",
"+",
".",
"If",
"this",
"fails",
"nil",
"is",
"returned",
"."
] | 528f250f84a46b0f3e6fccf06430ed413c7d994c | https://github.com/flori/protocol/blob/528f250f84a46b0f3e6fccf06430ed413c7d994c/lib/protocol/utilities.rb#L9-L19 |
1,623 | paddor/cztop | lib/cztop/monitor.rb | CZTop.Monitor.listen | def listen(*events)
events.each do |event|
EVENTS.include?(event) or
raise ArgumentError, "invalid event: #{event.inspect}"
end
@actor << [ "LISTEN", *events ]
end | ruby | def listen(*events)
events.each do |event|
EVENTS.include?(event) or
raise ArgumentError, "invalid event: #{event.inspect}"
end
@actor << [ "LISTEN", *events ]
end | [
"def",
"listen",
"(",
"*",
"events",
")",
"events",
".",
"each",
"do",
"|",
"event",
"|",
"EVENTS",
".",
"include?",
"(",
"event",
")",
"or",
"raise",
"ArgumentError",
",",
"\"invalid event: #{event.inspect}\"",
"end",
"@actor",
"<<",
"[",
"\"LISTEN\"",
",",... | Configure monitor to listen for specific events.
@param events [String] one or more events from {EVENTS}
@return [void] | [
"Configure",
"monitor",
"to",
"listen",
"for",
"specific",
"events",
"."
] | d20ee44775d05b60f40fffd1287a9b01270ab853 | https://github.com/paddor/cztop/blob/d20ee44775d05b60f40fffd1287a9b01270ab853/lib/cztop/monitor.rb#L63-L69 |
1,624 | damian/jshint | lib/jshint/reporters/junit.rb | Jshint::Reporters.Junit.print_errors_for_code | def print_errors_for_code(code, errors)
name = fetch_error_messages(code, errors)
output << " <testcase classname=\"jshint.#{code}\" name=\"#{escape(name)}\">\n"
errors.each do |error|
output << add_error_message(code, error)
end
output << " </testcase>\n"
output
en... | ruby | def print_errors_for_code(code, errors)
name = fetch_error_messages(code, errors)
output << " <testcase classname=\"jshint.#{code}\" name=\"#{escape(name)}\">\n"
errors.each do |error|
output << add_error_message(code, error)
end
output << " </testcase>\n"
output
en... | [
"def",
"print_errors_for_code",
"(",
"code",
",",
"errors",
")",
"name",
"=",
"fetch_error_messages",
"(",
"code",
",",
"errors",
")",
"output",
"<<",
"\" <testcase classname=\\\"jshint.#{code}\\\" name=\\\"#{escape(name)}\\\">\\n\"",
"errors",
".",
"each",
"do",
"|",
... | Appends new error elements to the Report output
@example
<testcase classname="JUnitXmlReporter.constructor" name="should default path to an empty string" time="0.006">
<failure message="test failure">Assertion failed</failure>
</testcase>
@param code [String] The error code
@param errors [Array] The errors ... | [
"Appends",
"new",
"error",
"elements",
"to",
"the",
"Report",
"output"
] | d7dc6f1913bad5927ac0de3e34714ef920e86cbe | https://github.com/damian/jshint/blob/d7dc6f1913bad5927ac0de3e34714ef920e86cbe/lib/jshint/reporters/junit.rb#L74-L82 |
1,625 | flori/protocol | lib/protocol/protocol_module.rb | Protocol.ProtocolModule.to_ruby | def to_ruby(result = '')
result << "#{name} = Protocol do"
first = true
if messages.empty?
result << "\n"
else
messages.each do |m|
result << "\n"
m.to_ruby(result)
end
end
result << "end\n"
end | ruby | def to_ruby(result = '')
result << "#{name} = Protocol do"
first = true
if messages.empty?
result << "\n"
else
messages.each do |m|
result << "\n"
m.to_ruby(result)
end
end
result << "end\n"
end | [
"def",
"to_ruby",
"(",
"result",
"=",
"''",
")",
"result",
"<<",
"\"#{name} = Protocol do\"",
"first",
"=",
"true",
"if",
"messages",
".",
"empty?",
"result",
"<<",
"\"\\n\"",
"else",
"messages",
".",
"each",
"do",
"|",
"m",
"|",
"result",
"<<",
"\"\\n\"",... | Concatenates the protocol as Ruby code to the +result+ string and return
it. At the moment this method only supports method signatures with
generic argument names. | [
"Concatenates",
"the",
"protocol",
"as",
"Ruby",
"code",
"to",
"the",
"+",
"result",
"+",
"string",
"and",
"return",
"it",
".",
"At",
"the",
"moment",
"this",
"method",
"only",
"supports",
"method",
"signatures",
"with",
"generic",
"argument",
"names",
"."
] | 528f250f84a46b0f3e6fccf06430ed413c7d994c | https://github.com/flori/protocol/blob/528f250f84a46b0f3e6fccf06430ed413c7d994c/lib/protocol/protocol_module.rb#L31-L43 |
1,626 | flori/protocol | lib/protocol/protocol_module.rb | Protocol.ProtocolModule.understand? | def understand?(name, arity = nil)
name = name.to_s
!!find { |m| m.name == name && (!arity || m.arity == arity) }
end | ruby | def understand?(name, arity = nil)
name = name.to_s
!!find { |m| m.name == name && (!arity || m.arity == arity) }
end | [
"def",
"understand?",
"(",
"name",
",",
"arity",
"=",
"nil",
")",
"name",
"=",
"name",
".",
"to_s",
"!",
"!",
"find",
"{",
"|",
"m",
"|",
"m",
".",
"name",
"==",
"name",
"&&",
"(",
"!",
"arity",
"||",
"m",
".",
"arity",
"==",
"arity",
")",
"}... | Returns true if it is required to understand the | [
"Returns",
"true",
"if",
"it",
"is",
"required",
"to",
"understand",
"the"
] | 528f250f84a46b0f3e6fccf06430ed413c7d994c | https://github.com/flori/protocol/blob/528f250f84a46b0f3e6fccf06430ed413c7d994c/lib/protocol/protocol_module.rb#L75-L78 |
1,627 | flori/protocol | lib/protocol/protocol_module.rb | Protocol.ProtocolModule.check_failures | def check_failures(object)
check object
rescue CheckFailed => e
return e.errors.map { |e| e.protocol_message }
end | ruby | def check_failures(object)
check object
rescue CheckFailed => e
return e.errors.map { |e| e.protocol_message }
end | [
"def",
"check_failures",
"(",
"object",
")",
"check",
"object",
"rescue",
"CheckFailed",
"=>",
"e",
"return",
"e",
".",
"errors",
".",
"map",
"{",
"|",
"e",
"|",
"e",
".",
"protocol_message",
"}",
"end"
] | Return all messages for whick a check failed. | [
"Return",
"all",
"messages",
"for",
"whick",
"a",
"check",
"failed",
"."
] | 528f250f84a46b0f3e6fccf06430ed413c7d994c | https://github.com/flori/protocol/blob/528f250f84a46b0f3e6fccf06430ed413c7d994c/lib/protocol/protocol_module.rb#L161-L165 |
1,628 | flori/protocol | lib/protocol/protocol_module.rb | Protocol.ProtocolModule.inherit | def inherit(modul, methodname, block_expected = nil)
Module === modul or
raise TypeError, "expected Module not #{modul.class} as modul argument"
methodnames = methodname.respond_to?(:to_ary) ?
methodname.to_ary :
[ methodname ]
methodnames.each do |methodname|
m = parse... | ruby | def inherit(modul, methodname, block_expected = nil)
Module === modul or
raise TypeError, "expected Module not #{modul.class} as modul argument"
methodnames = methodname.respond_to?(:to_ary) ?
methodname.to_ary :
[ methodname ]
methodnames.each do |methodname|
m = parse... | [
"def",
"inherit",
"(",
"modul",
",",
"methodname",
",",
"block_expected",
"=",
"nil",
")",
"Module",
"===",
"modul",
"or",
"raise",
"TypeError",
",",
"\"expected Module not #{modul.class} as modul argument\"",
"methodnames",
"=",
"methodname",
".",
"respond_to?",
"(",... | Inherit a method signature from an instance method named +methodname+ of
+modul+. This means that this protocol should understand these instance
methods with their arity and block expectation. Note that automatic
detection of blocks does not work for Ruby methods defined in C. You can
set the +block_expected+ argum... | [
"Inherit",
"a",
"method",
"signature",
"from",
"an",
"instance",
"method",
"named",
"+",
"methodname",
"+",
"of",
"+",
"modul",
"+",
".",
"This",
"means",
"that",
"this",
"protocol",
"should",
"understand",
"these",
"instance",
"methods",
"with",
"their",
"a... | 528f250f84a46b0f3e6fccf06430ed413c7d994c | https://github.com/flori/protocol/blob/528f250f84a46b0f3e6fccf06430ed413c7d994c/lib/protocol/protocol_module.rb#L234-L246 |
1,629 | flori/protocol | lib/protocol/protocol_module.rb | Protocol.ProtocolModule.method_added | def method_added(methodname)
methodname = methodname.to_s
if specification? and methodname !~ /^__protocol_check_/
protocol_check = instance_method(methodname)
parser = MethodParser.new(self, methodname)
if parser.complex?
define_method("__protocol_check_#{methodname}", pro... | ruby | def method_added(methodname)
methodname = methodname.to_s
if specification? and methodname !~ /^__protocol_check_/
protocol_check = instance_method(methodname)
parser = MethodParser.new(self, methodname)
if parser.complex?
define_method("__protocol_check_#{methodname}", pro... | [
"def",
"method_added",
"(",
"methodname",
")",
"methodname",
"=",
"methodname",
".",
"to_s",
"if",
"specification?",
"and",
"methodname",
"!~",
"/",
"/",
"protocol_check",
"=",
"instance_method",
"(",
"methodname",
")",
"parser",
"=",
"MethodParser",
".",
"new",... | Capture all added methods and either leave the implementation in place or
add them to the protocol description. | [
"Capture",
"all",
"added",
"methods",
"and",
"either",
"leave",
"the",
"implementation",
"in",
"place",
"or",
"add",
"them",
"to",
"the",
"protocol",
"description",
"."
] | 528f250f84a46b0f3e6fccf06430ed413c7d994c | https://github.com/flori/protocol/blob/528f250f84a46b0f3e6fccf06430ed413c7d994c/lib/protocol/protocol_module.rb#L274-L289 |
1,630 | paddor/cztop | lib/cztop/actor.rb | CZTop.Actor.<< | def <<(message)
message = Message.coerce(message)
if TERM == message[0]
# NOTE: can't just send this to the actor. The sender might call
# #terminate immediately, which most likely causes a hang due to race
# conditions.
terminate
else
begin
@mtx.sync... | ruby | def <<(message)
message = Message.coerce(message)
if TERM == message[0]
# NOTE: can't just send this to the actor. The sender might call
# #terminate immediately, which most likely causes a hang due to race
# conditions.
terminate
else
begin
@mtx.sync... | [
"def",
"<<",
"(",
"message",
")",
"message",
"=",
"Message",
".",
"coerce",
"(",
"message",
")",
"if",
"TERM",
"==",
"message",
"[",
"0",
"]",
"# NOTE: can't just send this to the actor. The sender might call",
"# #terminate immediately, which most likely causes a hang due ... | Creates a new actor. Either pass a callback directly or a block. The
block will be called for every received message.
In case the given callback is an FFI::Pointer (to a C function), it's
used as-is. It is expected to do the handshake (signal) itself.
@param callback [FFI::Pointer, Proc, #call] pointer to a C fun... | [
"Creates",
"a",
"new",
"actor",
".",
"Either",
"pass",
"a",
"callback",
"directly",
"or",
"a",
"block",
".",
"The",
"block",
"will",
"be",
"called",
"for",
"every",
"received",
"message",
"."
] | d20ee44775d05b60f40fffd1287a9b01270ab853 | https://github.com/paddor/cztop/blob/d20ee44775d05b60f40fffd1287a9b01270ab853/lib/cztop/actor.rb#L80-L113 |
1,631 | paddor/cztop | lib/cztop/actor.rb | CZTop.Actor.send_picture | def send_picture(picture, *args)
@mtx.synchronize do
raise DeadActorError if not @running
Zsock.send(ffi_delegate, picture, *args)
end
end | ruby | def send_picture(picture, *args)
@mtx.synchronize do
raise DeadActorError if not @running
Zsock.send(ffi_delegate, picture, *args)
end
end | [
"def",
"send_picture",
"(",
"picture",
",",
"*",
"args",
")",
"@mtx",
".",
"synchronize",
"do",
"raise",
"DeadActorError",
"if",
"not",
"@running",
"Zsock",
".",
"send",
"(",
"ffi_delegate",
",",
"picture",
",",
"args",
")",
"end",
"end"
] | Sends a message according to a "picture".
@see zsock_send() on http://api.zeromq.org/czmq3-0:zsock
@note Mainly added for {Beacon}. If implemented there, it wouldn't be
thread safe. And it's not that useful to be added to
{SendReceiveMethods}.
@param picture [String] message's part types
@param args [String, ... | [
"Sends",
"a",
"message",
"according",
"to",
"a",
"picture",
"."
] | d20ee44775d05b60f40fffd1287a9b01270ab853 | https://github.com/paddor/cztop/blob/d20ee44775d05b60f40fffd1287a9b01270ab853/lib/cztop/actor.rb#L152-L157 |
1,632 | paddor/cztop | lib/cztop/actor.rb | CZTop.Actor.terminate | def terminate
@mtx.synchronize do
return false if not @running
Message.new(TERM).send_to(self)
await_handler_death
true
end
rescue IO::EAGAINWaitWritable
# same as in #<<
retry
end | ruby | def terminate
@mtx.synchronize do
return false if not @running
Message.new(TERM).send_to(self)
await_handler_death
true
end
rescue IO::EAGAINWaitWritable
# same as in #<<
retry
end | [
"def",
"terminate",
"@mtx",
".",
"synchronize",
"do",
"return",
"false",
"if",
"not",
"@running",
"Message",
".",
"new",
"(",
"TERM",
")",
".",
"send_to",
"(",
"self",
")",
"await_handler_death",
"true",
"end",
"rescue",
"IO",
"::",
"EAGAINWaitWritable",
"# ... | Tells the actor to terminate and waits for it. Idempotent.
@return [Boolean] whether it died just now (+false+ if it was dead
already) | [
"Tells",
"the",
"actor",
"to",
"terminate",
"and",
"waits",
"for",
"it",
".",
"Idempotent",
"."
] | d20ee44775d05b60f40fffd1287a9b01270ab853 | https://github.com/paddor/cztop/blob/d20ee44775d05b60f40fffd1287a9b01270ab853/lib/cztop/actor.rb#L170-L180 |
1,633 | masciugo/genealogy | lib/genealogy/query_methods.rb | Genealogy.QueryMethods.ancestors | def ancestors(options = {})
ids = []
if options[:generations]
raise ArgumentError, ":generations option must be an Integer" unless options[:generations].is_a? Integer
generation_count = 0
generation_ids = parents.compact.map(&:id)
while (generation_count < options[:generation... | ruby | def ancestors(options = {})
ids = []
if options[:generations]
raise ArgumentError, ":generations option must be an Integer" unless options[:generations].is_a? Integer
generation_count = 0
generation_ids = parents.compact.map(&:id)
while (generation_count < options[:generation... | [
"def",
"ancestors",
"(",
"options",
"=",
"{",
"}",
")",
"ids",
"=",
"[",
"]",
"if",
"options",
"[",
":generations",
"]",
"raise",
"ArgumentError",
",",
"\":generations option must be an Integer\"",
"unless",
"options",
"[",
":generations",
"]",
".",
"is_a?",
"... | get list of known ancestrors iterateing over parents
@param [Hash] options
@option options [Symbol] generations lets you limit how many generations will be included in the output.
@return [ActiveRecord::Relation] list of ancestors (limited by a number of generations if so indicated) | [
"get",
"list",
"of",
"known",
"ancestrors",
"iterateing",
"over",
"parents"
] | e29eeb1d63cd352d52abf1819ec21659364f90a7 | https://github.com/masciugo/genealogy/blob/e29eeb1d63cd352d52abf1819ec21659364f90a7/lib/genealogy/query_methods.rb#L133-L157 |
1,634 | masciugo/genealogy | lib/genealogy/query_methods.rb | Genealogy.QueryMethods.descendants | def descendants(options = {})
ids = []
if options[:generations]
generation_count = 0
generation_ids = children.map(&:id)
while (generation_count < options[:generations]) && (generation_ids.length > 0)
next_gen_ids = []
ids += generation_ids
until generat... | ruby | def descendants(options = {})
ids = []
if options[:generations]
generation_count = 0
generation_ids = children.map(&:id)
while (generation_count < options[:generations]) && (generation_ids.length > 0)
next_gen_ids = []
ids += generation_ids
until generat... | [
"def",
"descendants",
"(",
"options",
"=",
"{",
"}",
")",
"ids",
"=",
"[",
"]",
"if",
"options",
"[",
":generations",
"]",
"generation_count",
"=",
"0",
"generation_ids",
"=",
"children",
".",
"map",
"(",
":id",
")",
"while",
"(",
"generation_count",
"<"... | get list of known descendants iterateing over children ...
@param [Hash] options
@option options [Symbol] generations lets you limit how many generations will be included in the output.
@return [ActiveRecord::Relation] list of descendants (limited by a number of generations if so indicated) | [
"get",
"list",
"of",
"known",
"descendants",
"iterateing",
"over",
"children",
"..."
] | e29eeb1d63cd352d52abf1819ec21659364f90a7 | https://github.com/masciugo/genealogy/blob/e29eeb1d63cd352d52abf1819ec21659364f90a7/lib/genealogy/query_methods.rb#L164-L188 |
1,635 | masciugo/genealogy | lib/genealogy/query_methods.rb | Genealogy.QueryMethods.uncles_and_aunts | def uncles_and_aunts(options={})
relation = case options[:lineage]
when :paternal
[father]
when :maternal
[mother]
else
parents
end
ids = relation.compact.inject([]){|memo,parent| memo |= parent.siblings(half: options[:half]).pluck(:id)}
gclass.where(id:... | ruby | def uncles_and_aunts(options={})
relation = case options[:lineage]
when :paternal
[father]
when :maternal
[mother]
else
parents
end
ids = relation.compact.inject([]){|memo,parent| memo |= parent.siblings(half: options[:half]).pluck(:id)}
gclass.where(id:... | [
"def",
"uncles_and_aunts",
"(",
"options",
"=",
"{",
"}",
")",
"relation",
"=",
"case",
"options",
"[",
":lineage",
"]",
"when",
":paternal",
"[",
"father",
"]",
"when",
":maternal",
"[",
"mother",
"]",
"else",
"parents",
"end",
"ids",
"=",
"relation",
"... | list of uncles and aunts iterating through parents' siblings
@param [Hash] options
@option options [Symbol] lineage to filter by lineage: :paternal or :maternal
@option options [Symbol] half to filter by half siblings (see #siblings)
@return [ActiveRecord::Relation] list of uncles and aunts | [
"list",
"of",
"uncles",
"and",
"aunts",
"iterating",
"through",
"parents",
"siblings"
] | e29eeb1d63cd352d52abf1819ec21659364f90a7 | https://github.com/masciugo/genealogy/blob/e29eeb1d63cd352d52abf1819ec21659364f90a7/lib/genealogy/query_methods.rb#L205-L216 |
1,636 | paddor/cztop | lib/cztop/poller.rb | CZTop.Poller.modify | def modify(socket, events)
ptr = ptr_for_socket(socket)
rc = ZMQ.poller_modify(@poller_ptr, ptr, events)
HasFFIDelegate.raise_zmq_err if rc == -1
remember_socket(socket, events)
end | ruby | def modify(socket, events)
ptr = ptr_for_socket(socket)
rc = ZMQ.poller_modify(@poller_ptr, ptr, events)
HasFFIDelegate.raise_zmq_err if rc == -1
remember_socket(socket, events)
end | [
"def",
"modify",
"(",
"socket",
",",
"events",
")",
"ptr",
"=",
"ptr_for_socket",
"(",
"socket",
")",
"rc",
"=",
"ZMQ",
".",
"poller_modify",
"(",
"@poller_ptr",
",",
"ptr",
",",
"events",
")",
"HasFFIDelegate",
".",
"raise_zmq_err",
"if",
"rc",
"==",
"-... | Modifies the events of interest for the given socket.
@param socket [Socket, Actor] the socket
@param events [Integer] events you're interested in (see constants in
{ZMQ}
@return [void]
@raise [ArgumentError] if it's not a socket | [
"Modifies",
"the",
"events",
"of",
"interest",
"for",
"the",
"given",
"socket",
"."
] | d20ee44775d05b60f40fffd1287a9b01270ab853 | https://github.com/paddor/cztop/blob/d20ee44775d05b60f40fffd1287a9b01270ab853/lib/cztop/poller.rb#L62-L67 |
1,637 | paddor/cztop | lib/cztop/poller.rb | CZTop.Poller.remove | def remove(socket)
ptr = ptr_for_socket(socket)
rc = ZMQ.poller_remove(@poller_ptr, ptr)
HasFFIDelegate.raise_zmq_err if rc == -1
forget_socket(socket)
end | ruby | def remove(socket)
ptr = ptr_for_socket(socket)
rc = ZMQ.poller_remove(@poller_ptr, ptr)
HasFFIDelegate.raise_zmq_err if rc == -1
forget_socket(socket)
end | [
"def",
"remove",
"(",
"socket",
")",
"ptr",
"=",
"ptr_for_socket",
"(",
"socket",
")",
"rc",
"=",
"ZMQ",
".",
"poller_remove",
"(",
"@poller_ptr",
",",
"ptr",
")",
"HasFFIDelegate",
".",
"raise_zmq_err",
"if",
"rc",
"==",
"-",
"1",
"forget_socket",
"(",
... | Removes a previously registered socket. Won't raise if you're
trying to remove a socket that's not registered.
@param socket [Socket, Actor] the socket
@return [void]
@raise [ArgumentError] if it's not a socket | [
"Removes",
"a",
"previously",
"registered",
"socket",
".",
"Won",
"t",
"raise",
"if",
"you",
"re",
"trying",
"to",
"remove",
"a",
"socket",
"that",
"s",
"not",
"registered",
"."
] | d20ee44775d05b60f40fffd1287a9b01270ab853 | https://github.com/paddor/cztop/blob/d20ee44775d05b60f40fffd1287a9b01270ab853/lib/cztop/poller.rb#L74-L79 |
1,638 | paddor/cztop | lib/cztop/poller.rb | CZTop.Poller.remove_reader | def remove_reader(socket)
if event_mask_for_socket(socket) == ZMQ::POLLIN
remove(socket)
return
end
raise ArgumentError, "not registered for readability only: %p" % socket
end | ruby | def remove_reader(socket)
if event_mask_for_socket(socket) == ZMQ::POLLIN
remove(socket)
return
end
raise ArgumentError, "not registered for readability only: %p" % socket
end | [
"def",
"remove_reader",
"(",
"socket",
")",
"if",
"event_mask_for_socket",
"(",
"socket",
")",
"==",
"ZMQ",
"::",
"POLLIN",
"remove",
"(",
"socket",
")",
"return",
"end",
"raise",
"ArgumentError",
",",
"\"not registered for readability only: %p\"",
"%",
"socket",
... | Removes a reader socket that was registered for readability only.
@param socket [Socket, Actor] the socket
@raise [ArgumentError] if it's not registered, not registered for
readability, or registered for more than just readability | [
"Removes",
"a",
"reader",
"socket",
"that",
"was",
"registered",
"for",
"readability",
"only",
"."
] | d20ee44775d05b60f40fffd1287a9b01270ab853 | https://github.com/paddor/cztop/blob/d20ee44775d05b60f40fffd1287a9b01270ab853/lib/cztop/poller.rb#L86-L92 |
1,639 | paddor/cztop | lib/cztop/poller.rb | CZTop.Poller.remove_writer | def remove_writer(socket)
if event_mask_for_socket(socket) == ZMQ::POLLOUT
remove(socket)
return
end
raise ArgumentError, "not registered for writability only: %p" % socket
end | ruby | def remove_writer(socket)
if event_mask_for_socket(socket) == ZMQ::POLLOUT
remove(socket)
return
end
raise ArgumentError, "not registered for writability only: %p" % socket
end | [
"def",
"remove_writer",
"(",
"socket",
")",
"if",
"event_mask_for_socket",
"(",
"socket",
")",
"==",
"ZMQ",
"::",
"POLLOUT",
"remove",
"(",
"socket",
")",
"return",
"end",
"raise",
"ArgumentError",
",",
"\"not registered for writability only: %p\"",
"%",
"socket",
... | Removes a reader socket that was registered for writability only.
@param socket [Socket, Actor] the socket
@raise [ArgumentError] if it's not registered, not registered for
writability, or registered for more than just writability | [
"Removes",
"a",
"reader",
"socket",
"that",
"was",
"registered",
"for",
"writability",
"only",
"."
] | d20ee44775d05b60f40fffd1287a9b01270ab853 | https://github.com/paddor/cztop/blob/d20ee44775d05b60f40fffd1287a9b01270ab853/lib/cztop/poller.rb#L99-L105 |
1,640 | paddor/cztop | lib/cztop/poller.rb | CZTop.Poller.wait | def wait(timeout = -1)
rc = ZMQ.poller_wait(@poller_ptr, @event_ptr, timeout)
if rc == -1
case CZMQ::FFI::Errors.errno
# NOTE: ETIMEDOUT for backwards compatibility, although this API is
# still DRAFT.
when Errno::EAGAIN::Errno, Errno::ETIMEDOUT::Errno
return nil
... | ruby | def wait(timeout = -1)
rc = ZMQ.poller_wait(@poller_ptr, @event_ptr, timeout)
if rc == -1
case CZMQ::FFI::Errors.errno
# NOTE: ETIMEDOUT for backwards compatibility, although this API is
# still DRAFT.
when Errno::EAGAIN::Errno, Errno::ETIMEDOUT::Errno
return nil
... | [
"def",
"wait",
"(",
"timeout",
"=",
"-",
"1",
")",
"rc",
"=",
"ZMQ",
".",
"poller_wait",
"(",
"@poller_ptr",
",",
"@event_ptr",
",",
"timeout",
")",
"if",
"rc",
"==",
"-",
"1",
"case",
"CZMQ",
"::",
"FFI",
"::",
"Errors",
".",
"errno",
"# NOTE: ETIME... | Waits for registered sockets to become readable or writable, depending
on what you're interested in.
@param timeout [Integer] how long to wait in ms, or 0 to avoid blocking,
or -1 to wait indefinitely
@return [Event] the first event of interest
@return [nil] if the timeout expired or
@raise [SystemCallError] i... | [
"Waits",
"for",
"registered",
"sockets",
"to",
"become",
"readable",
"or",
"writable",
"depending",
"on",
"what",
"you",
"re",
"interested",
"in",
"."
] | d20ee44775d05b60f40fffd1287a9b01270ab853 | https://github.com/paddor/cztop/blob/d20ee44775d05b60f40fffd1287a9b01270ab853/lib/cztop/poller.rb#L115-L128 |
1,641 | hawkular/hawkular-client-ruby | lib/hawkular/operations/operations_api.rb | Hawkular::Operations.Client.invoke_specific_operation | def invoke_specific_operation(operation_payload, operation_name, &callback)
fail Hawkular::ArgumentError, 'Operation must be specified' if operation_name.nil?
required = %i[resourceId feedId]
check_pre_conditions operation_payload, required, &callback
invoke_operation_helper(operation_payload, ... | ruby | def invoke_specific_operation(operation_payload, operation_name, &callback)
fail Hawkular::ArgumentError, 'Operation must be specified' if operation_name.nil?
required = %i[resourceId feedId]
check_pre_conditions operation_payload, required, &callback
invoke_operation_helper(operation_payload, ... | [
"def",
"invoke_specific_operation",
"(",
"operation_payload",
",",
"operation_name",
",",
"&",
"callback",
")",
"fail",
"Hawkular",
"::",
"ArgumentError",
",",
"'Operation must be specified'",
"if",
"operation_name",
".",
"nil?",
"required",
"=",
"%i[",
"resourceId",
... | Invokes operation on the WildFly agent that has it's own message type
@param operation_payload [Hash{String=>Object}] a hash containing: resourceId [String] denoting
the resource on which the operation is about to run, feedId [String]
@param operation_name [String] the name of the operation. This must correspond wit... | [
"Invokes",
"operation",
"on",
"the",
"WildFly",
"agent",
"that",
"has",
"it",
"s",
"own",
"message",
"type"
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/operations/operations_api.rb#L169-L175 |
1,642 | hawkular/hawkular-client-ruby | lib/hawkular/operations/operations_api.rb | Hawkular::Operations.Client.add_deployment | def add_deployment(hash, &callback)
hash[:enabled] = hash.key?(:enabled) ? hash[:enabled] : true
hash[:force_deploy] = hash.key?(:force_deploy) ? hash[:force_deploy] : false
required = %i[resource_id feed_id destination_file_name binary_content]
check_pre_conditions hash, required, &callback
... | ruby | def add_deployment(hash, &callback)
hash[:enabled] = hash.key?(:enabled) ? hash[:enabled] : true
hash[:force_deploy] = hash.key?(:force_deploy) ? hash[:force_deploy] : false
required = %i[resource_id feed_id destination_file_name binary_content]
check_pre_conditions hash, required, &callback
... | [
"def",
"add_deployment",
"(",
"hash",
",",
"&",
"callback",
")",
"hash",
"[",
":enabled",
"]",
"=",
"hash",
".",
"key?",
"(",
":enabled",
")",
"?",
"hash",
"[",
":enabled",
"]",
":",
"true",
"hash",
"[",
":force_deploy",
"]",
"=",
"hash",
".",
"key?"... | Deploys an archive file into WildFly
@param [Hash] hash Arguments for deployment
@option hash [String] :resource_id ID of the WildFly server into which we deploy
or of the domain controller if we deploy into a server group (in case of domain mode)
@option hash [String] :feed_id feed contai... | [
"Deploys",
"an",
"archive",
"file",
"into",
"WildFly"
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/operations/operations_api.rb#L190-L198 |
1,643 | hawkular/hawkular-client-ruby | lib/hawkular/operations/operations_api.rb | Hawkular::Operations.Client.undeploy | def undeploy(hash, &callback)
hash[:remove_content] = hash.key?(:remove_content) ? hash[:remove_content] : true
required = %i[resource_id feed_id deployment_name]
check_pre_conditions hash, required, &callback
hash[:destination_file_name] = hash[:deployment_name]
operation_payload = prep... | ruby | def undeploy(hash, &callback)
hash[:remove_content] = hash.key?(:remove_content) ? hash[:remove_content] : true
required = %i[resource_id feed_id deployment_name]
check_pre_conditions hash, required, &callback
hash[:destination_file_name] = hash[:deployment_name]
operation_payload = prep... | [
"def",
"undeploy",
"(",
"hash",
",",
"&",
"callback",
")",
"hash",
"[",
":remove_content",
"]",
"=",
"hash",
".",
"key?",
"(",
":remove_content",
")",
"?",
"hash",
"[",
":remove_content",
"]",
":",
"true",
"required",
"=",
"%i[",
"resource_id",
"feed_id",
... | Undeploy a WildFly deployment
@param [Hash] hash Arguments for deployment removal
@option hash [String] :resource_id ID of the WildFly server from which to undeploy the deployment
@option hash [String] :feed_id feed containing this resource
@option hash [String] :deployment_name name of deployment to undeploy
... | [
"Undeploy",
"a",
"WildFly",
"deployment"
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/operations/operations_api.rb#L210-L219 |
1,644 | hawkular/hawkular-client-ruby | lib/hawkular/operations/operations_api.rb | Hawkular::Operations.Client.enable_deployment | def enable_deployment(hash, &callback)
required = %i[resource_id feed_id deployment_name]
check_pre_conditions hash, required, &callback
hash[:destination_file_name] = hash[:deployment_name]
operation_payload = prepare_payload_hash([:deployment_name], hash)
invoke_operation_helper(operat... | ruby | def enable_deployment(hash, &callback)
required = %i[resource_id feed_id deployment_name]
check_pre_conditions hash, required, &callback
hash[:destination_file_name] = hash[:deployment_name]
operation_payload = prepare_payload_hash([:deployment_name], hash)
invoke_operation_helper(operat... | [
"def",
"enable_deployment",
"(",
"hash",
",",
"&",
"callback",
")",
"required",
"=",
"%i[",
"resource_id",
"feed_id",
"deployment_name",
"]",
"check_pre_conditions",
"hash",
",",
"required",
",",
"callback",
"hash",
"[",
":destination_file_name",
"]",
"=",
"hash",... | Enable a WildFly deployment
@param [Hash] hash Arguments for enable deployment
@option hash [String] :resource_id ID of the WildFly server from which to enable the deployment
@option hash [String] :feed_id feed containing this resource
@option hash [String] :deployment_name name of deployment to enable
@option... | [
"Enable",
"a",
"WildFly",
"deployment"
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/operations/operations_api.rb#L230-L238 |
1,645 | hawkular/hawkular-client-ruby | lib/hawkular/operations/operations_api.rb | Hawkular::Operations.Client.export_jdr | def export_jdr(resource_id, feed_id, delete_immediately = false, sender_request_id = nil, &callback)
fail Hawkular::ArgumentError, 'resource_id must be specified' if resource_id.nil?
fail Hawkular::ArgumentError, 'feed_id must be specified' if feed_id.nil?
check_pre_conditions(&callback)
invoke... | ruby | def export_jdr(resource_id, feed_id, delete_immediately = false, sender_request_id = nil, &callback)
fail Hawkular::ArgumentError, 'resource_id must be specified' if resource_id.nil?
fail Hawkular::ArgumentError, 'feed_id must be specified' if feed_id.nil?
check_pre_conditions(&callback)
invoke... | [
"def",
"export_jdr",
"(",
"resource_id",
",",
"feed_id",
",",
"delete_immediately",
"=",
"false",
",",
"sender_request_id",
"=",
"nil",
",",
"&",
"callback",
")",
"fail",
"Hawkular",
"::",
"ArgumentError",
",",
"'resource_id must be specified'",
"if",
"resource_id",... | Exports the JDR report
@param [String] resource_id ID of the WildFly server
@param [String] feed_id ID of the feed containing the WildFly server
@param [Boolean] delete_immediately specifies whether the temporary file at the remote
server should be deleted. False, by default.
@param callback [Block] callback that... | [
"Exports",
"the",
"JDR",
"report"
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/operations/operations_api.rb#L330-L340 |
1,646 | hawkular/hawkular-client-ruby | lib/hawkular/operations/operations_api.rb | Hawkular::Operations.Client.update_collection_intervals | def update_collection_intervals(hash, &callback)
required = %i[resourceId feedId metricTypes availTypes]
check_pre_conditions hash, required, &callback
invoke_specific_operation(hash, 'UpdateCollectionIntervals', &callback)
end | ruby | def update_collection_intervals(hash, &callback)
required = %i[resourceId feedId metricTypes availTypes]
check_pre_conditions hash, required, &callback
invoke_specific_operation(hash, 'UpdateCollectionIntervals', &callback)
end | [
"def",
"update_collection_intervals",
"(",
"hash",
",",
"&",
"callback",
")",
"required",
"=",
"%i[",
"resourceId",
"feedId",
"metricTypes",
"availTypes",
"]",
"check_pre_conditions",
"hash",
",",
"required",
",",
"callback",
"invoke_specific_operation",
"(",
"hash",
... | Updates the collection intervals.
@param [Hash] hash Arguments for update collection intervals
@option hash {resourceId} a resource managed by the target agent
@option hash {feedId} the related feed ID
@option hash {metricTypes} A map with key=MetricTypeId, value=interval (seconds).
MetricTypeId must be of form M... | [
"Updates",
"the",
"collection",
"intervals",
"."
] | 3b07729c2ab359e3199c282e199a3f1699ddc49c | https://github.com/hawkular/hawkular-client-ruby/blob/3b07729c2ab359e3199c282e199a3f1699ddc49c/lib/hawkular/operations/operations_api.rb#L353-L357 |
1,647 | bfoz/geometry | lib/geometry/polyline.rb | Geometry.Polyline.close! | def close!
unless @edges.empty?
# NOTE: parallel? is use here instead of collinear? because the
# edges are connected, and will therefore be collinear if
# they're parallel
if closed?
if @edges.first.parallel?(@edges.last)
unshift_edge Edge.new(@edges.last.first, shift_edge.last)
end
elsi... | ruby | def close!
unless @edges.empty?
# NOTE: parallel? is use here instead of collinear? because the
# edges are connected, and will therefore be collinear if
# they're parallel
if closed?
if @edges.first.parallel?(@edges.last)
unshift_edge Edge.new(@edges.last.first, shift_edge.last)
end
elsi... | [
"def",
"close!",
"unless",
"@edges",
".",
"empty?",
"# NOTE: parallel? is use here instead of collinear? because the",
"#\tedges are connected, and will therefore be collinear if",
"#\tthey're parallel",
"if",
"closed?",
"if",
"@edges",
".",
"first",
".",
"parallel?",
"(",
"@edge... | Close the receiver and return it
@return [Polyline] the receiver after closing | [
"Close",
"the",
"receiver",
"and",
"return",
"it"
] | 3054ccba59f184c172be52a6f0b7cf4a33f617a5 | https://github.com/bfoz/geometry/blob/3054ccba59f184c172be52a6f0b7cf4a33f617a5/lib/geometry/polyline.rb#L127-L159 |
1,648 | bfoz/geometry | lib/geometry/polyline.rb | Geometry.Polyline.bisector_map | def bisector_map
winding = 0
tangent_loop.each_cons(2).map do |v1,v2|
k = v1[0]*v2[1] - v1[1]*v2[0] # z-component of v1 x v2
winding += k
if v1 == v2 # collinear, same direction?
bisector = Vector[-v1[1], v1[0]]
block_given? ? (bisector * yield(bisector, 1)) : bisector
elsif 0 == k # c... | ruby | def bisector_map
winding = 0
tangent_loop.each_cons(2).map do |v1,v2|
k = v1[0]*v2[1] - v1[1]*v2[0] # z-component of v1 x v2
winding += k
if v1 == v2 # collinear, same direction?
bisector = Vector[-v1[1], v1[0]]
block_given? ? (bisector * yield(bisector, 1)) : bisector
elsif 0 == k # c... | [
"def",
"bisector_map",
"winding",
"=",
"0",
"tangent_loop",
".",
"each_cons",
"(",
"2",
")",
".",
"map",
"do",
"|",
"v1",
",",
"v2",
"|",
"k",
"=",
"v1",
"[",
"0",
"]",
"*",
"v2",
"[",
"1",
"]",
"-",
"v1",
"[",
"1",
"]",
"*",
"v2",
"[",
"0"... | Generate bisectors and k values with an optional mapping block
@note If the {Polyline} isn't closed (the normal case), then the first and
last vertices will be given bisectors that are perpendicular to themselves.
@return [Array<Vector>] the unit {Vector}s representing the angle bisector of each vertex | [
"Generate",
"bisectors",
"and",
"k",
"values",
"with",
"an",
"optional",
"mapping",
"block"
] | 3054ccba59f184c172be52a6f0b7cf4a33f617a5 | https://github.com/bfoz/geometry/blob/3054ccba59f184c172be52a6f0b7cf4a33f617a5/lib/geometry/polyline.rb#L281-L304 |
1,649 | bfoz/geometry | lib/geometry/polyline.rb | Geometry.Polyline.tangent_loop | def tangent_loop
edges.map {|e| e.direction }.tap do |tangents|
# Generating a bisector for each vertex requires an edge on both sides of each vertex.
# Obviously, the first and last vertices each have only a single adjacent edge, unless the
# Polyline happens to be closed (like a Polygon). When not closed, ... | ruby | def tangent_loop
edges.map {|e| e.direction }.tap do |tangents|
# Generating a bisector for each vertex requires an edge on both sides of each vertex.
# Obviously, the first and last vertices each have only a single adjacent edge, unless the
# Polyline happens to be closed (like a Polygon). When not closed, ... | [
"def",
"tangent_loop",
"edges",
".",
"map",
"{",
"|",
"e",
"|",
"e",
".",
"direction",
"}",
".",
"tap",
"do",
"|",
"tangents",
"|",
"# Generating a bisector for each vertex requires an edge on both sides of each vertex.",
"# Obviously, the first and last vertices each have on... | Generate the tangents and fake a circular buffer while accounting for closedness
@return [Array<Vector>] the tangents | [
"Generate",
"the",
"tangents",
"and",
"fake",
"a",
"circular",
"buffer",
"while",
"accounting",
"for",
"closedness"
] | 3054ccba59f184c172be52a6f0b7cf4a33f617a5 | https://github.com/bfoz/geometry/blob/3054ccba59f184c172be52a6f0b7cf4a33f617a5/lib/geometry/polyline.rb#L317-L333 |
1,650 | bfoz/geometry | lib/geometry/polyline.rb | Geometry.Polyline.find_next_intersection | def find_next_intersection(edges, i, e)
for j in i..(edges.count-1)
e2 = edges[j][:edge]
next if !e2 || e.connected?(e2)
intersection = e.intersection(e2)
return [intersection, j] if intersection
end
nil
end | ruby | def find_next_intersection(edges, i, e)
for j in i..(edges.count-1)
e2 = edges[j][:edge]
next if !e2 || e.connected?(e2)
intersection = e.intersection(e2)
return [intersection, j] if intersection
end
nil
end | [
"def",
"find_next_intersection",
"(",
"edges",
",",
"i",
",",
"e",
")",
"for",
"j",
"in",
"i",
"..",
"(",
"edges",
".",
"count",
"-",
"1",
")",
"e2",
"=",
"edges",
"[",
"j",
"]",
"[",
":edge",
"]",
"next",
"if",
"!",
"e2",
"||",
"e",
".",
"co... | Find the next edge that intersects with e, starting at index i | [
"Find",
"the",
"next",
"edge",
"that",
"intersects",
"with",
"e",
"starting",
"at",
"index",
"i"
] | 3054ccba59f184c172be52a6f0b7cf4a33f617a5 | https://github.com/bfoz/geometry/blob/3054ccba59f184c172be52a6f0b7cf4a33f617a5/lib/geometry/polyline.rb#L336-L344 |
1,651 | bfoz/geometry | lib/geometry/polyline.rb | Geometry.Polyline.find_last_intersection | def find_last_intersection(edges, i, e)
intersection, intersection_at = nil, nil
for j in i..(edges.count-1)
e2 = edges[j][:edge]
next if !e2 || e.connected?(e2)
_intersection = e.intersection(e2)
intersection, intersection_at = _intersection, j if _intersection
end
[intersection, intersecti... | ruby | def find_last_intersection(edges, i, e)
intersection, intersection_at = nil, nil
for j in i..(edges.count-1)
e2 = edges[j][:edge]
next if !e2 || e.connected?(e2)
_intersection = e.intersection(e2)
intersection, intersection_at = _intersection, j if _intersection
end
[intersection, intersecti... | [
"def",
"find_last_intersection",
"(",
"edges",
",",
"i",
",",
"e",
")",
"intersection",
",",
"intersection_at",
"=",
"nil",
",",
"nil",
"for",
"j",
"in",
"i",
"..",
"(",
"edges",
".",
"count",
"-",
"1",
")",
"e2",
"=",
"edges",
"[",
"j",
"]",
"[",
... | Find the last edge that intersects with e, starting at index i | [
"Find",
"the",
"last",
"edge",
"that",
"intersects",
"with",
"e",
"starting",
"at",
"index",
"i"
] | 3054ccba59f184c172be52a6f0b7cf4a33f617a5 | https://github.com/bfoz/geometry/blob/3054ccba59f184c172be52a6f0b7cf4a33f617a5/lib/geometry/polyline.rb#L347-L356 |
1,652 | paddor/cztop | lib/cztop/config.rb | CZTop.Config.[] | def [](path, default = "")
ptr = ffi_delegate.get(path, default)
return nil if ptr.null?
ptr.read_string
end | ruby | def [](path, default = "")
ptr = ffi_delegate.get(path, default)
return nil if ptr.null?
ptr.read_string
end | [
"def",
"[]",
"(",
"path",
",",
"default",
"=",
"\"\"",
")",
"ptr",
"=",
"ffi_delegate",
".",
"get",
"(",
"path",
",",
"default",
")",
"return",
"nil",
"if",
"ptr",
".",
"null?",
"ptr",
".",
"read_string",
"end"
] | Get the value of the current config item.
@param path [String, #to_s] path to config item
@param default [String, #to_s] default value to return if config item
doesn't exist
@return [String]
@return [default] if config item doesn't exist
@note The default value is not returned when the config item exists but
... | [
"Get",
"the",
"value",
"of",
"the",
"current",
"config",
"item",
"."
] | d20ee44775d05b60f40fffd1287a9b01270ab853 | https://github.com/paddor/cztop/blob/d20ee44775d05b60f40fffd1287a9b01270ab853/lib/cztop/config.rb#L95-L99 |
1,653 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.9/xmlrpc/create.rb | XMLRPC.Create.methodResponse | def methodResponse(is_ret, *params)
if is_ret
resp = params.collect do |param|
@writer.ele("param", conv2value(param))
end
resp = [@writer.ele("params", *resp)]
else
if params.size != 1 or params[0] === XMLRPC::FaultException
raise ArgumentError, "no val... | ruby | def methodResponse(is_ret, *params)
if is_ret
resp = params.collect do |param|
@writer.ele("param", conv2value(param))
end
resp = [@writer.ele("params", *resp)]
else
if params.size != 1 or params[0] === XMLRPC::FaultException
raise ArgumentError, "no val... | [
"def",
"methodResponse",
"(",
"is_ret",
",",
"*",
"params",
")",
"if",
"is_ret",
"resp",
"=",
"params",
".",
"collect",
"do",
"|",
"param",
"|",
"@writer",
".",
"ele",
"(",
"\"param\"",
",",
"conv2value",
"(",
"param",
")",
")",
"end",
"resp",
"=",
"... | generates a XML-RPC methodResponse document
if is_ret == false then the params array must
contain only one element, which is a structure
of a fault return-value.
if is_ret == true then a normal
return-value of all the given params is created. | [
"generates",
"a",
"XML",
"-",
"RPC",
"methodResponse",
"document"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.9/xmlrpc/create.rb#L144-L166 |
1,654 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/fragments.rb | SM.LineCollection.add_list_start_and_ends | def add_list_start_and_ends
level = 0
res = []
type_stack = []
@fragments.each do |fragment|
# $stderr.puts "#{level} : #{fragment.class.name} : #{fragment.level}"
new_level = fragment.level
while (level < new_level)
level += 1
type = fragment.type
... | ruby | def add_list_start_and_ends
level = 0
res = []
type_stack = []
@fragments.each do |fragment|
# $stderr.puts "#{level} : #{fragment.class.name} : #{fragment.level}"
new_level = fragment.level
while (level < new_level)
level += 1
type = fragment.type
... | [
"def",
"add_list_start_and_ends",
"level",
"=",
"0",
"res",
"=",
"[",
"]",
"type_stack",
"=",
"[",
"]",
"@fragments",
".",
"each",
"do",
"|",
"fragment",
"|",
"# $stderr.puts \"#{level} : #{fragment.class.name} : #{fragment.level}\"",
"new_level",
"=",
"fragment",
"."... | List nesting is implicit given the level of
Make it explicit, just to make life a tad
easier for the output processors | [
"List",
"nesting",
"is",
"implicit",
"given",
"the",
"level",
"of",
"Make",
"it",
"explicit",
"just",
"to",
"make",
"life",
"a",
"tad",
"easier",
"for",
"the",
"output",
"processors"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/fragments.rb#L239-L271 |
1,655 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/packagetask.rb | Rake.PackageTask.init | def init(name, version)
@name = name
@version = version
@package_files = Rake::FileList.new
@package_dir = 'pkg'
@need_tar = false
@need_tar_gz = false
@need_tar_bz2 = false
@need_zip = false
@tar_command = 'tar'
@zip_command = 'zip'
end | ruby | def init(name, version)
@name = name
@version = version
@package_files = Rake::FileList.new
@package_dir = 'pkg'
@need_tar = false
@need_tar_gz = false
@need_tar_bz2 = false
@need_zip = false
@tar_command = 'tar'
@zip_command = 'zip'
end | [
"def",
"init",
"(",
"name",
",",
"version",
")",
"@name",
"=",
"name",
"@version",
"=",
"version",
"@package_files",
"=",
"Rake",
"::",
"FileList",
".",
"new",
"@package_dir",
"=",
"'pkg'",
"@need_tar",
"=",
"false",
"@need_tar_gz",
"=",
"false",
"@need_tar_... | Create a Package Task with the given name and version.
Initialization that bypasses the "yield self" and "define" step. | [
"Create",
"a",
"Package",
"Task",
"with",
"the",
"given",
"name",
"and",
"version",
".",
"Initialization",
"that",
"bypasses",
"the",
"yield",
"self",
"and",
"define",
"step",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/packagetask.rb#L85-L96 |
1,656 | maintux/esx | lib/esx.rb | ESX.Host.create_vm | def create_vm(specification)
spec = specification
spec[:cpus] = (specification[:cpus] || 1).to_i
spec[:cpu_cores] = (specification[:cpu_cores] || 1).to_i
spec[:guest_id] = specification[:guest_id] || 'otherGuest'
spec[:hw_version] = (specification[:hw_version] || 8).to_i
if specificatio... | ruby | def create_vm(specification)
spec = specification
spec[:cpus] = (specification[:cpus] || 1).to_i
spec[:cpu_cores] = (specification[:cpu_cores] || 1).to_i
spec[:guest_id] = specification[:guest_id] || 'otherGuest'
spec[:hw_version] = (specification[:hw_version] || 8).to_i
if specificatio... | [
"def",
"create_vm",
"(",
"specification",
")",
"spec",
"=",
"specification",
"spec",
"[",
":cpus",
"]",
"=",
"(",
"specification",
"[",
":cpus",
"]",
"||",
"1",
")",
".",
"to_i",
"spec",
"[",
":cpu_cores",
"]",
"=",
"(",
"specification",
"[",
":cpu_cores... | Create a Virtual Machine
Requires a Hash with the following keys:
{
:vm_name => name, (string, required)
:cpus => 1, #(int, optional)
:guest_id => 'otherGuest', #(string, optional)
:disk_size => 4096, #(in MB, optional)
:memory => 128, #(in MB, optional)
:datastore => datastore1 #(string, optiona... | [
"Create",
"a",
"Virtual",
"Machine"
] | ac02f2ef1b6294dfaa811fe638250cb3c000eeb6 | https://github.com/maintux/esx/blob/ac02f2ef1b6294dfaa811fe638250cb3c000eeb6/lib/esx.rb#L126-L207 |
1,657 | maintux/esx | lib/esx.rb | ESX.Host.host_info | def host_info
[
@_host.summary.config.product.fullName,
@_host.summary.config.product.apiType,
@_host.summary.config.product.apiVersion,
@_host.summary.config.product.osType,
@_host.summary.config.product.productLineId,
@_host.summary.config.product.vendor,
@_host.... | ruby | def host_info
[
@_host.summary.config.product.fullName,
@_host.summary.config.product.apiType,
@_host.summary.config.product.apiVersion,
@_host.summary.config.product.osType,
@_host.summary.config.product.productLineId,
@_host.summary.config.product.vendor,
@_host.... | [
"def",
"host_info",
"[",
"@_host",
".",
"summary",
".",
"config",
".",
"product",
".",
"fullName",
",",
"@_host",
".",
"summary",
".",
"config",
".",
"product",
".",
"apiType",
",",
"@_host",
".",
"summary",
".",
"config",
".",
"product",
".",
"apiVersio... | Return product info as an array of strings containing
fullName, apiType, apiVersion, osType, productLineId, vendor, version | [
"Return",
"product",
"info",
"as",
"an",
"array",
"of",
"strings",
"containing"
] | ac02f2ef1b6294dfaa811fe638250cb3c000eeb6 | https://github.com/maintux/esx/blob/ac02f2ef1b6294dfaa811fe638250cb3c000eeb6/lib/esx.rb#L234-L244 |
1,658 | maintux/esx | lib/esx.rb | ESX.Host.remote_command | def remote_command(cmd)
output = ""
Net::SSH.start(@address, @user, :password => @password) do |ssh|
output = ssh.exec! cmd
end
output
end | ruby | def remote_command(cmd)
output = ""
Net::SSH.start(@address, @user, :password => @password) do |ssh|
output = ssh.exec! cmd
end
output
end | [
"def",
"remote_command",
"(",
"cmd",
")",
"output",
"=",
"\"\"",
"Net",
"::",
"SSH",
".",
"start",
"(",
"@address",
",",
"@user",
",",
":password",
"=>",
"@password",
")",
"do",
"|",
"ssh",
"|",
"output",
"=",
"ssh",
".",
"exec!",
"cmd",
"end",
"outp... | Run a command in the ESX host via SSH | [
"Run",
"a",
"command",
"in",
"the",
"ESX",
"host",
"via",
"SSH"
] | ac02f2ef1b6294dfaa811fe638250cb3c000eeb6 | https://github.com/maintux/esx/blob/ac02f2ef1b6294dfaa811fe638250cb3c000eeb6/lib/esx.rb#L272-L278 |
1,659 | maintux/esx | lib/esx.rb | ESX.Host.copy_from_template | def copy_from_template(template_disk, destination)
Log.debug "Copying from template #{template_disk} to #{destination}"
raise "Template does not exist" if not template_exist?(template_disk)
source = File.join(@templates_dir, File.basename(template_disk))
Net::SSH.start(@address, @user, :password... | ruby | def copy_from_template(template_disk, destination)
Log.debug "Copying from template #{template_disk} to #{destination}"
raise "Template does not exist" if not template_exist?(template_disk)
source = File.join(@templates_dir, File.basename(template_disk))
Net::SSH.start(@address, @user, :password... | [
"def",
"copy_from_template",
"(",
"template_disk",
",",
"destination",
")",
"Log",
".",
"debug",
"\"Copying from template #{template_disk} to #{destination}\"",
"raise",
"\"Template does not exist\"",
"if",
"not",
"template_exist?",
"(",
"template_disk",
")",
"source",
"=",
... | Expects vmdk source file path and destination path
copy_from_template "/home/fooser/my.vmdk", "/vmfs/volumes/datastore1/foovm/foovm.vmdk"
Destination directory must exist otherwise rises exception | [
"Expects",
"vmdk",
"source",
"file",
"path",
"and",
"destination",
"path"
] | ac02f2ef1b6294dfaa811fe638250cb3c000eeb6 | https://github.com/maintux/esx/blob/ac02f2ef1b6294dfaa811fe638250cb3c000eeb6/lib/esx.rb#L356-L364 |
1,660 | maintux/esx | lib/esx.rb | ESX.Host.import_disk | def import_disk(source, destination, print_progress = false, params = {})
use_template = params[:use_template] || false
if use_template
Log.debug "import_disk :use_template => true"
if !template_exist?(source)
Log.debug "import_disk, template does not exist, importing."
i... | ruby | def import_disk(source, destination, print_progress = false, params = {})
use_template = params[:use_template] || false
if use_template
Log.debug "import_disk :use_template => true"
if !template_exist?(source)
Log.debug "import_disk, template does not exist, importing."
i... | [
"def",
"import_disk",
"(",
"source",
",",
"destination",
",",
"print_progress",
"=",
"false",
",",
"params",
"=",
"{",
"}",
")",
"use_template",
"=",
"params",
"[",
":use_template",
"]",
"||",
"false",
"if",
"use_template",
"Log",
".",
"debug",
"\"import_dis... | Imports a VMDK
if params has :use_template => true, the disk is saved as a template in
@templates_dir and cloned from there.
Destination directory must exist otherwise rises exception | [
"Imports",
"a",
"VMDK"
] | ac02f2ef1b6294dfaa811fe638250cb3c000eeb6 | https://github.com/maintux/esx/blob/ac02f2ef1b6294dfaa811fe638250cb3c000eeb6/lib/esx.rb#L374-L386 |
1,661 | maintux/esx | lib/esx.rb | ESX.Host.import_disk_convert | def import_disk_convert(source, destination, print_progress = false)
tmp_dest = destination + ".tmp"
Net::SSH.start(@address, @user, :password => @password) do |ssh|
if not (ssh.exec! "ls #{destination} 2>/dev/null").nil?
raise Exception.new("Destination file #{destination} already exists"... | ruby | def import_disk_convert(source, destination, print_progress = false)
tmp_dest = destination + ".tmp"
Net::SSH.start(@address, @user, :password => @password) do |ssh|
if not (ssh.exec! "ls #{destination} 2>/dev/null").nil?
raise Exception.new("Destination file #{destination} already exists"... | [
"def",
"import_disk_convert",
"(",
"source",
",",
"destination",
",",
"print_progress",
"=",
"false",
")",
"tmp_dest",
"=",
"destination",
"+",
"\".tmp\"",
"Net",
"::",
"SSH",
".",
"start",
"(",
"@address",
",",
"@user",
",",
":password",
"=>",
"@password",
... | This method does all the heavy lifting when importing the disk.
It also converts the imported VMDK to thin format | [
"This",
"method",
"does",
"all",
"the",
"heavy",
"lifting",
"when",
"importing",
"the",
"disk",
".",
"It",
"also",
"converts",
"the",
"imported",
"VMDK",
"to",
"thin",
"format"
] | ac02f2ef1b6294dfaa811fe638250cb3c000eeb6 | https://github.com/maintux/esx/blob/ac02f2ef1b6294dfaa811fe638250cb3c000eeb6/lib/esx.rb#L392-L411 |
1,662 | maintux/esx | lib/esx.rb | ESX.Host.create_disk_spec | def create_disk_spec(params)
disk_type = params[:disk_type] || :flat
disk_file = params[:disk_file]
if disk_type == :sparse and disk_file.nil?
raise Exception.new("Creating sparse disks in ESX is not supported. Use an existing image.")
end
disk_size = params[:disk_size]
datas... | ruby | def create_disk_spec(params)
disk_type = params[:disk_type] || :flat
disk_file = params[:disk_file]
if disk_type == :sparse and disk_file.nil?
raise Exception.new("Creating sparse disks in ESX is not supported. Use an existing image.")
end
disk_size = params[:disk_size]
datas... | [
"def",
"create_disk_spec",
"(",
"params",
")",
"disk_type",
"=",
"params",
"[",
":disk_type",
"]",
"||",
":flat",
"disk_file",
"=",
"params",
"[",
":disk_file",
"]",
"if",
"disk_type",
"==",
":sparse",
"and",
"disk_file",
".",
"nil?",
"raise",
"Exception",
"... | disk_file
datastore
disk_size
disk_type | [
"disk_file",
"datastore",
"disk_size",
"disk_type"
] | ac02f2ef1b6294dfaa811fe638250cb3c000eeb6 | https://github.com/maintux/esx/blob/ac02f2ef1b6294dfaa811fe638250cb3c000eeb6/lib/esx.rb#L424-L461 |
1,663 | maintux/esx | lib/esx.rb | ESX.VM.destroy | def destroy
#disks = vm_object.config.hardware.device.grep(RbVmomi::VIM::VirtualDisk)
unless host.free_license
vm_object.Destroy_Task.wait_for_completion
else
host.remote_command "vim-cmd vmsvc/power.off #{vmid}"
host.remote_command "vim-cmd vmsvc/destroy #{vmid}"
end
... | ruby | def destroy
#disks = vm_object.config.hardware.device.grep(RbVmomi::VIM::VirtualDisk)
unless host.free_license
vm_object.Destroy_Task.wait_for_completion
else
host.remote_command "vim-cmd vmsvc/power.off #{vmid}"
host.remote_command "vim-cmd vmsvc/destroy #{vmid}"
end
... | [
"def",
"destroy",
"#disks = vm_object.config.hardware.device.grep(RbVmomi::VIM::VirtualDisk)",
"unless",
"host",
".",
"free_license",
"vm_object",
".",
"Destroy_Task",
".",
"wait_for_completion",
"else",
"host",
".",
"remote_command",
"\"vim-cmd vmsvc/power.off #{vmid}\"",
"host",
... | Destroy the VirtualMaching removing it from the inventory
and deleting the disk files | [
"Destroy",
"the",
"VirtualMaching",
"removing",
"it",
"from",
"the",
"inventory",
"and",
"deleting",
"the",
"disk",
"files"
] | ac02f2ef1b6294dfaa811fe638250cb3c000eeb6 | https://github.com/maintux/esx/blob/ac02f2ef1b6294dfaa811fe638250cb3c000eeb6/lib/esx.rb#L524-L532 |
1,664 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/ri/ri_formatter.rb | RI.AttributeFormatter.write_attribute_text | def write_attribute_text(prefix, line)
print prefix
line.each do |achar|
print achar.char
end
puts
end | ruby | def write_attribute_text(prefix, line)
print prefix
line.each do |achar|
print achar.char
end
puts
end | [
"def",
"write_attribute_text",
"(",
"prefix",
",",
"line",
")",
"print",
"prefix",
"line",
".",
"each",
"do",
"|",
"achar",
"|",
"print",
"achar",
".",
"char",
"end",
"puts",
"end"
] | overridden in specific formatters | [
"overridden",
"in",
"specific",
"formatters"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/ri/ri_formatter.rb#L331-L337 |
1,665 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/ri/ri_formatter.rb | RI.OverstrikeFormatter.bold_print | def bold_print(text)
text.split(//).each do |ch|
print ch, BS, ch
end
end | ruby | def bold_print(text)
text.split(//).each do |ch|
print ch, BS, ch
end
end | [
"def",
"bold_print",
"(",
"text",
")",
"text",
".",
"split",
"(",
"/",
"/",
")",
".",
"each",
"do",
"|",
"ch",
"|",
"print",
"ch",
",",
"BS",
",",
"ch",
"end",
"end"
] | draw a string in bold | [
"draw",
"a",
"string",
"in",
"bold"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/ri/ri_formatter.rb#L390-L394 |
1,666 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/ri/ri_formatter.rb | RI.SimpleFormatter.display_heading | def display_heading(text, level, indent)
text = strip_attributes(text)
case level
when 1
puts "= " + text.upcase
when 2
puts "-- " + text
else
print indent, text, "\n"
end
end | ruby | def display_heading(text, level, indent)
text = strip_attributes(text)
case level
when 1
puts "= " + text.upcase
when 2
puts "-- " + text
else
print indent, text, "\n"
end
end | [
"def",
"display_heading",
"(",
"text",
",",
"level",
",",
"indent",
")",
"text",
"=",
"strip_attributes",
"(",
"text",
")",
"case",
"level",
"when",
"1",
"puts",
"\"= \"",
"+",
"text",
".",
"upcase",
"when",
"2",
"puts",
"\"-- \"",
"+",
"text",
"else",
... | Place heading level indicators inline with heading. | [
"Place",
"heading",
"level",
"indicators",
"inline",
"with",
"heading",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/ri/ri_formatter.rb#L633-L643 |
1,667 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/request.rb | Rack.Request.POST | def POST
if @env["rack.request.form_input"].eql? @env["rack.input"]
@env["rack.request.form_hash"]
elsif form_data? || parseable_data?
@env["rack.request.form_input"] = @env["rack.input"]
unless @env["rack.request.form_hash"] =
Utils::Multipart.parse_multipart(env)
... | ruby | def POST
if @env["rack.request.form_input"].eql? @env["rack.input"]
@env["rack.request.form_hash"]
elsif form_data? || parseable_data?
@env["rack.request.form_input"] = @env["rack.input"]
unless @env["rack.request.form_hash"] =
Utils::Multipart.parse_multipart(env)
... | [
"def",
"POST",
"if",
"@env",
"[",
"\"rack.request.form_input\"",
"]",
".",
"eql?",
"@env",
"[",
"\"rack.input\"",
"]",
"@env",
"[",
"\"rack.request.form_hash\"",
"]",
"elsif",
"form_data?",
"||",
"parseable_data?",
"@env",
"[",
"\"rack.request.form_input\"",
"]",
"=... | Returns the data recieved in the request body.
This method support both application/x-www-form-urlencoded and
multipart/form-data. | [
"Returns",
"the",
"data",
"recieved",
"in",
"the",
"request",
"body",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/request.rb#L127-L148 |
1,668 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/request.rb | Rack.Request.url | def url
url = scheme + "://"
url << host
if scheme == "https" && port != 443 ||
scheme == "http" && port != 80
url << ":#{port}"
end
url << fullpath
url
end | ruby | def url
url = scheme + "://"
url << host
if scheme == "https" && port != 443 ||
scheme == "http" && port != 80
url << ":#{port}"
end
url << fullpath
url
end | [
"def",
"url",
"url",
"=",
"scheme",
"+",
"\"://\"",
"url",
"<<",
"host",
"if",
"scheme",
"==",
"\"https\"",
"&&",
"port",
"!=",
"443",
"||",
"scheme",
"==",
"\"http\"",
"&&",
"port",
"!=",
"80",
"url",
"<<",
"\":#{port}\"",
"end",
"url",
"<<",
"fullpat... | Tries to return a remake of the original request URL as a string. | [
"Tries",
"to",
"return",
"a",
"remake",
"of",
"the",
"original",
"request",
"URL",
"as",
"a",
"string",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/request.rb#L204-L216 |
1,669 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb | DRb.DRbProtocol.open | def open(uri, config, first=true)
@protocol.each do |prot|
begin
return prot.open(uri, config)
rescue DRbBadScheme
rescue DRbConnError
raise($!)
rescue
raise(DRbConnError, "#{uri} - #{$!.inspect}")
end
end
if first && (config[:auto_load] != false)
auto_load(uri, config)
return open(ur... | ruby | def open(uri, config, first=true)
@protocol.each do |prot|
begin
return prot.open(uri, config)
rescue DRbBadScheme
rescue DRbConnError
raise($!)
rescue
raise(DRbConnError, "#{uri} - #{$!.inspect}")
end
end
if first && (config[:auto_load] != false)
auto_load(uri, config)
return open(ur... | [
"def",
"open",
"(",
"uri",
",",
"config",
",",
"first",
"=",
"true",
")",
"@protocol",
".",
"each",
"do",
"|",
"prot",
"|",
"begin",
"return",
"prot",
".",
"open",
"(",
"uri",
",",
"config",
")",
"rescue",
"DRbBadScheme",
"rescue",
"DRbConnError",
"rai... | Open a client connection to +uri+ with the configuration +config+.
The DRbProtocol module asks each registered protocol in turn to
try to open the URI. Each protocol signals that it does not handle that
URI by raising a DRbBadScheme error. If no protocol recognises the
URI, then a DRbBadURI error is raised. If ... | [
"Open",
"a",
"client",
"connection",
"to",
"+",
"uri",
"+",
"with",
"the",
"configuration",
"+",
"config",
"+",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb#L758-L774 |
1,670 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb | DRb.DRbProtocol.open_server | def open_server(uri, config, first=true)
@protocol.each do |prot|
begin
return prot.open_server(uri, config)
rescue DRbBadScheme
end
end
if first && (config[:auto_load] != false)
auto_load(uri, config)
return open_server(uri, config, false)
end
raise DRbBadURI, 'can\'t parse uri:' ... | ruby | def open_server(uri, config, first=true)
@protocol.each do |prot|
begin
return prot.open_server(uri, config)
rescue DRbBadScheme
end
end
if first && (config[:auto_load] != false)
auto_load(uri, config)
return open_server(uri, config, false)
end
raise DRbBadURI, 'can\'t parse uri:' ... | [
"def",
"open_server",
"(",
"uri",
",",
"config",
",",
"first",
"=",
"true",
")",
"@protocol",
".",
"each",
"do",
"|",
"prot",
"|",
"begin",
"return",
"prot",
".",
"open_server",
"(",
"uri",
",",
"config",
")",
"rescue",
"DRbBadScheme",
"end",
"end",
"i... | Open a server listening for connections at +uri+ with
configuration +config+.
The DRbProtocol module asks each registered protocol in turn to
try to open a server at the URI. Each protocol signals that it does
not handle that URI by raising a DRbBadScheme error. If no protocol
recognises the URI, then a DRbBadU... | [
"Open",
"a",
"server",
"listening",
"for",
"connections",
"at",
"+",
"uri",
"+",
"with",
"configuration",
"+",
"config",
"+",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb#L786-L798 |
1,671 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb | DRb.DRbTCPSocket.send_request | def send_request(ref, msg_id, arg, b)
@msg.send_request(stream, ref, msg_id, arg, b)
end | ruby | def send_request(ref, msg_id, arg, b)
@msg.send_request(stream, ref, msg_id, arg, b)
end | [
"def",
"send_request",
"(",
"ref",
",",
"msg_id",
",",
"arg",
",",
"b",
")",
"@msg",
".",
"send_request",
"(",
"stream",
",",
"ref",
",",
"msg_id",
",",
"arg",
",",
"b",
")",
"end"
] | On the client side, send a request to the server. | [
"On",
"the",
"client",
"side",
"send",
"a",
"request",
"to",
"the",
"server",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb#L937-L939 |
1,672 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb | DRb.DRbObject.method_missing | def method_missing(msg_id, *a, &b)
if DRb.here?(@uri)
obj = DRb.to_obj(@ref)
DRb.current_server.check_insecure_method(obj, msg_id)
return obj.__send__(msg_id, *a, &b)
end
succ, result = self.class.with_friend(@uri) do
DRbConn.open(@uri) do |conn|
conn.send_message(self, msg_id, ... | ruby | def method_missing(msg_id, *a, &b)
if DRb.here?(@uri)
obj = DRb.to_obj(@ref)
DRb.current_server.check_insecure_method(obj, msg_id)
return obj.__send__(msg_id, *a, &b)
end
succ, result = self.class.with_friend(@uri) do
DRbConn.open(@uri) do |conn|
conn.send_message(self, msg_id, ... | [
"def",
"method_missing",
"(",
"msg_id",
",",
"*",
"a",
",",
"&",
"b",
")",
"if",
"DRb",
".",
"here?",
"(",
"@uri",
")",
"obj",
"=",
"DRb",
".",
"to_obj",
"(",
"@ref",
")",
"DRb",
".",
"current_server",
".",
"check_insecure_method",
"(",
"obj",
",",
... | Routes method calls to the referenced object. | [
"Routes",
"method",
"calls",
"to",
"the",
"referenced",
"object",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb#L1114-L1136 |
1,673 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb | DRb.DRbServer.stop_service | def stop_service
DRb.remove_server(self)
if Thread.current['DRb'] && Thread.current['DRb']['server'] == self
Thread.current['DRb']['stop_service'] = true
else
@thread.kill
end
end | ruby | def stop_service
DRb.remove_server(self)
if Thread.current['DRb'] && Thread.current['DRb']['server'] == self
Thread.current['DRb']['stop_service'] = true
else
@thread.kill
end
end | [
"def",
"stop_service",
"DRb",
".",
"remove_server",
"(",
"self",
")",
"if",
"Thread",
".",
"current",
"[",
"'DRb'",
"]",
"&&",
"Thread",
".",
"current",
"[",
"'DRb'",
"]",
"[",
"'server'",
"]",
"==",
"self",
"Thread",
".",
"current",
"[",
"'DRb'",
"]",... | Stop this server. | [
"Stop",
"this",
"server",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb#L1427-L1434 |
1,674 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb | DRb.DRbServer.to_obj | def to_obj(ref)
return front if ref.nil?
return front[ref.to_s] if DRbURIOption === ref
@idconv.to_obj(ref)
end | ruby | def to_obj(ref)
return front if ref.nil?
return front[ref.to_s] if DRbURIOption === ref
@idconv.to_obj(ref)
end | [
"def",
"to_obj",
"(",
"ref",
")",
"return",
"front",
"if",
"ref",
".",
"nil?",
"return",
"front",
"[",
"ref",
".",
"to_s",
"]",
"if",
"DRbURIOption",
"===",
"ref",
"@idconv",
".",
"to_obj",
"(",
"ref",
")",
"end"
] | Convert a dRuby reference to the local object it refers to. | [
"Convert",
"a",
"dRuby",
"reference",
"to",
"the",
"local",
"object",
"it",
"refers",
"to",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb#L1437-L1441 |
1,675 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb | DRb.DRbServer.check_insecure_method | def check_insecure_method(obj, msg_id)
return true if Proc === obj && msg_id == :__drb_yield
raise(ArgumentError, "#{any_to_s(msg_id)} is not a symbol") unless Symbol == msg_id.class
raise(SecurityError, "insecure method `#{msg_id}'") if insecure_method?(msg_id)
if obj.private_methods.inc... | ruby | def check_insecure_method(obj, msg_id)
return true if Proc === obj && msg_id == :__drb_yield
raise(ArgumentError, "#{any_to_s(msg_id)} is not a symbol") unless Symbol == msg_id.class
raise(SecurityError, "insecure method `#{msg_id}'") if insecure_method?(msg_id)
if obj.private_methods.inc... | [
"def",
"check_insecure_method",
"(",
"obj",
",",
"msg_id",
")",
"return",
"true",
"if",
"Proc",
"===",
"obj",
"&&",
"msg_id",
"==",
":__drb_yield",
"raise",
"(",
"ArgumentError",
",",
"\"#{any_to_s(msg_id)} is not a symbol\"",
")",
"unless",
"Symbol",
"==",
"msg_i... | Check that a method is callable via dRuby.
+obj+ is the object we want to invoke the method on. +msg_id+ is the
method name, as a Symbol.
If the method is an insecure method (see #insecure_method?) a
SecurityError is thrown. If the method is private or undefined,
a NameError is thrown. | [
"Check",
"that",
"a",
"method",
"is",
"callable",
"via",
"dRuby",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb#L1505-L1519 |
1,676 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb | DRb.DRbServer.main_loop | def main_loop
Thread.start(@protocol.accept) do |client|
@grp.add Thread.current
Thread.current['DRb'] = { 'client' => client ,
'server' => self }
loop do
begin
succ = false
invoke_method = InvokeMethod.new(self, client)
succ, result = invoke_method.perform
if ... | ruby | def main_loop
Thread.start(@protocol.accept) do |client|
@grp.add Thread.current
Thread.current['DRb'] = { 'client' => client ,
'server' => self }
loop do
begin
succ = false
invoke_method = InvokeMethod.new(self, client)
succ, result = invoke_method.perform
if ... | [
"def",
"main_loop",
"Thread",
".",
"start",
"(",
"@protocol",
".",
"accept",
")",
"do",
"|",
"client",
"|",
"@grp",
".",
"add",
"Thread",
".",
"current",
"Thread",
".",
"current",
"[",
"'DRb'",
"]",
"=",
"{",
"'client'",
"=>",
"client",
",",
"'server'"... | The main loop performed by a DRbServer's internal thread.
Accepts a connection from a client, and starts up its own
thread to handle it. This thread loops, receiving requests
from the client, invoking them on a local object, and
returning responses, until the client closes the connection
or a local method call f... | [
"The",
"main",
"loop",
"performed",
"by",
"a",
"DRbServer",
"s",
"internal",
"thread",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/drb/drb.rb#L1618-L1644 |
1,677 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/jdbc_adapter/jdbc_postgre.rb | ::JdbcSpec.PostgreSQL.supports_standard_conforming_strings? | def supports_standard_conforming_strings?
# Temporarily set the client message level above error to prevent unintentional
# error messages in the logs when working on a PostgreSQL database server that
# does not support standard conforming strings.
client_min_messages_old = client_min_messages
... | ruby | def supports_standard_conforming_strings?
# Temporarily set the client message level above error to prevent unintentional
# error messages in the logs when working on a PostgreSQL database server that
# does not support standard conforming strings.
client_min_messages_old = client_min_messages
... | [
"def",
"supports_standard_conforming_strings?",
"# Temporarily set the client message level above error to prevent unintentional",
"# error messages in the logs when working on a PostgreSQL database server that",
"# does not support standard conforming strings.",
"client_min_messages_old",
"=",
"clien... | Does PostgreSQL support standard conforming strings? | [
"Does",
"PostgreSQL",
"support",
"standard",
"conforming",
"strings?"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/jdbc_adapter/jdbc_postgre.rb#L120-L133 |
1,678 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rdoctask.rb | Rake.RDocTask.define | def define
if rdoc_task_name != "rdoc"
desc "Build the RDOC HTML Files"
else
desc "Build the #{rdoc_task_name} HTML Files"
end
task rdoc_task_name
desc "Force a rebuild of the RDOC files"
task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
... | ruby | def define
if rdoc_task_name != "rdoc"
desc "Build the RDOC HTML Files"
else
desc "Build the #{rdoc_task_name} HTML Files"
end
task rdoc_task_name
desc "Force a rebuild of the RDOC files"
task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
... | [
"def",
"define",
"if",
"rdoc_task_name",
"!=",
"\"rdoc\"",
"desc",
"\"Build the RDOC HTML Files\"",
"else",
"desc",
"\"Build the #{rdoc_task_name} HTML Files\"",
"end",
"task",
"rdoc_task_name",
"desc",
"\"Force a rebuild of the RDOC files\"",
"task",
"rerdoc_task_name",
"=>",
... | Create an RDoc task with the given name. See the RDocTask class overview
for documentation.
Create the tasks defined by this task lib. | [
"Create",
"an",
"RDoc",
"task",
"with",
"the",
"given",
"name",
".",
"See",
"the",
"RDocTask",
"class",
"overview",
"for",
"documentation",
".",
"Create",
"the",
"tasks",
"defined",
"by",
"this",
"task",
"lib",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rdoctask.rb#L111-L144 |
1,679 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/runit/assert.rb | RUNIT.Assert.assert_match | def assert_match(actual_string, expected_re, message="")
_wrap_assertion {
full_message = build_message(message, "Expected <?> to match <?>", actual_string, expected_re)
assert_block(full_message) {
expected_re =~ actual_string
}
Regexp.last_match
}
end | ruby | def assert_match(actual_string, expected_re, message="")
_wrap_assertion {
full_message = build_message(message, "Expected <?> to match <?>", actual_string, expected_re)
assert_block(full_message) {
expected_re =~ actual_string
}
Regexp.last_match
}
end | [
"def",
"assert_match",
"(",
"actual_string",
",",
"expected_re",
",",
"message",
"=",
"\"\"",
")",
"_wrap_assertion",
"{",
"full_message",
"=",
"build_message",
"(",
"message",
",",
"\"Expected <?> to match <?>\"",
",",
"actual_string",
",",
"expected_re",
")",
"ass... | To deal with the fact that RubyUnit does not check that the
regular expression is, indeed, a regular expression, if it is
not, we do our own assertion using the same semantics as
RubyUnit | [
"To",
"deal",
"with",
"the",
"fact",
"that",
"RubyUnit",
"does",
"not",
"check",
"that",
"the",
"regular",
"expression",
"is",
"indeed",
"a",
"regular",
"expression",
"if",
"it",
"is",
"not",
"we",
"do",
"our",
"own",
"assertion",
"using",
"the",
"same",
... | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/runit/assert.rb#L23-L31 |
1,680 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/gempackagetask.rb | Rake.GemPackageTask.init | def init(gem)
super(gem.name, gem.version)
@gem_spec = gem
@package_files += gem_spec.files if gem_spec.files
end | ruby | def init(gem)
super(gem.name, gem.version)
@gem_spec = gem
@package_files += gem_spec.files if gem_spec.files
end | [
"def",
"init",
"(",
"gem",
")",
"super",
"(",
"gem",
".",
"name",
",",
"gem",
".",
"version",
")",
"@gem_spec",
"=",
"gem",
"@package_files",
"+=",
"gem_spec",
".",
"files",
"if",
"gem_spec",
".",
"files",
"end"
] | Create a GEM Package task library. Automatically define the gem
if a block is given. If no block is supplied, then +define+
needs to be called to define the task.
Initialization tasks without the "yield self" or define
operations. | [
"Create",
"a",
"GEM",
"Package",
"task",
"library",
".",
"Automatically",
"define",
"the",
"gem",
"if",
"a",
"block",
"is",
"given",
".",
"If",
"no",
"block",
"is",
"supplied",
"then",
"+",
"define",
"+",
"needs",
"to",
"be",
"called",
"to",
"define",
... | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/gempackagetask.rb#L64-L68 |
1,681 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/xml_mini/rexml.rb | ActiveSupport.XmlMini_REXML.parse | def parse(string)
require 'rexml/document' unless defined?(REXML::Document)
doc = REXML::Document.new(string)
merge_element!({}, doc.root)
end | ruby | def parse(string)
require 'rexml/document' unless defined?(REXML::Document)
doc = REXML::Document.new(string)
merge_element!({}, doc.root)
end | [
"def",
"parse",
"(",
"string",
")",
"require",
"'rexml/document'",
"unless",
"defined?",
"(",
"REXML",
"::",
"Document",
")",
"doc",
"=",
"REXML",
"::",
"Document",
".",
"new",
"(",
"string",
")",
"merge_element!",
"(",
"{",
"}",
",",
"doc",
".",
"root",... | Parse an XML Document string into a simple hash
Same as XmlSimple::xml_in but doesn't shoot itself in the foot,
and uses the defaults from ActiveSupport
string::
XML Document string to parse | [
"Parse",
"an",
"XML",
"Document",
"string",
"into",
"a",
"simple",
"hash"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/xml_mini/rexml.rb#L15-L19 |
1,682 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/to_html.rb | SM.ToHtml.init_tags | def init_tags
@attr_tags = [
InlineTag.new(SM::Attribute.bitmap_for(:BOLD), "<b>", "</b>"),
InlineTag.new(SM::Attribute.bitmap_for(:TT), "<tt>", "</tt>"),
InlineTag.new(SM::Attribute.bitmap_for(:EM), "<em>", "</em>"),
]
end | ruby | def init_tags
@attr_tags = [
InlineTag.new(SM::Attribute.bitmap_for(:BOLD), "<b>", "</b>"),
InlineTag.new(SM::Attribute.bitmap_for(:TT), "<tt>", "</tt>"),
InlineTag.new(SM::Attribute.bitmap_for(:EM), "<em>", "</em>"),
]
end | [
"def",
"init_tags",
"@attr_tags",
"=",
"[",
"InlineTag",
".",
"new",
"(",
"SM",
"::",
"Attribute",
".",
"bitmap_for",
"(",
":BOLD",
")",
",",
"\"<b>\"",
",",
"\"</b>\"",
")",
",",
"InlineTag",
".",
"new",
"(",
"SM",
"::",
"Attribute",
".",
"bitmap_for",
... | Set up the standard mapping of attributes to HTML tags | [
"Set",
"up",
"the",
"standard",
"mapping",
"of",
"attributes",
"to",
"HTML",
"tags"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/to_html.rb#L28-L34 |
1,683 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/to_html.rb | SM.ToHtml.add_tag | def add_tag(name, start, stop)
@attr_tags << InlineTag.new(SM::Attribute.bitmap_for(name), start, stop)
end | ruby | def add_tag(name, start, stop)
@attr_tags << InlineTag.new(SM::Attribute.bitmap_for(name), start, stop)
end | [
"def",
"add_tag",
"(",
"name",
",",
"start",
",",
"stop",
")",
"@attr_tags",
"<<",
"InlineTag",
".",
"new",
"(",
"SM",
"::",
"Attribute",
".",
"bitmap_for",
"(",
"name",
")",
",",
"start",
",",
"stop",
")",
"end"
] | Add a new set of HTML tags for an attribute. We allow
separate start and end tags for flexibility | [
"Add",
"a",
"new",
"set",
"of",
"HTML",
"tags",
"for",
"an",
"attribute",
".",
"We",
"allow",
"separate",
"start",
"and",
"end",
"tags",
"for",
"flexibility"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/to_html.rb#L40-L42 |
1,684 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/net/http.rb | Net.HTTPHeader.set_form_data | def set_form_data(params, sep = '&')
self.body = params.map {|k,v| "#{urlencode(k.to_s)}=#{urlencode(v.to_s)}" }.join(sep)
self.content_type = 'application/x-www-form-urlencoded'
end | ruby | def set_form_data(params, sep = '&')
self.body = params.map {|k,v| "#{urlencode(k.to_s)}=#{urlencode(v.to_s)}" }.join(sep)
self.content_type = 'application/x-www-form-urlencoded'
end | [
"def",
"set_form_data",
"(",
"params",
",",
"sep",
"=",
"'&'",
")",
"self",
".",
"body",
"=",
"params",
".",
"map",
"{",
"|",
"k",
",",
"v",
"|",
"\"#{urlencode(k.to_s)}=#{urlencode(v.to_s)}\"",
"}",
".",
"join",
"(",
"sep",
")",
"self",
".",
"content_ty... | Set header fields and a body from HTML form data.
+params+ should be a Hash containing HTML form data.
Optional argument +sep+ means data record separator.
This method also set Content-Type: header field to
application/x-www-form-urlencoded. | [
"Set",
"header",
"fields",
"and",
"a",
"body",
"from",
"HTML",
"form",
"data",
".",
"+",
"params",
"+",
"should",
"be",
"a",
"Hash",
"containing",
"HTML",
"form",
"data",
".",
"Optional",
"argument",
"+",
"sep",
"+",
"means",
"data",
"record",
"separator... | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/net/http.rb#L1432-L1435 |
1,685 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rinda/rinda.rb | Rinda.Tuple.each | def each # FIXME
if Hash === @tuple
@tuple.each { |k, v| yield(k, v) }
else
@tuple.each_with_index { |v, k| yield(k, v) }
end
end | ruby | def each # FIXME
if Hash === @tuple
@tuple.each { |k, v| yield(k, v) }
else
@tuple.each_with_index { |v, k| yield(k, v) }
end
end | [
"def",
"each",
"# FIXME",
"if",
"Hash",
"===",
"@tuple",
"@tuple",
".",
"each",
"{",
"|",
"k",
",",
"v",
"|",
"yield",
"(",
"k",
",",
"v",
")",
"}",
"else",
"@tuple",
".",
"each_with_index",
"{",
"|",
"v",
",",
"k",
"|",
"yield",
"(",
"k",
",",... | Iterate through the tuple, yielding the index or key, and the
value, thus ensuring arrays are iterated similarly to hashes. | [
"Iterate",
"through",
"the",
"tuple",
"yielding",
"the",
"index",
"or",
"key",
"and",
"the",
"value",
"thus",
"ensuring",
"arrays",
"are",
"iterated",
"similarly",
"to",
"hashes",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rinda/rinda.rb#L84-L90 |
1,686 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rinda/rinda.rb | Rinda.Tuple.init_with_ary | def init_with_ary(ary)
@tuple = Array.new(ary.size)
@tuple.size.times do |i|
@tuple[i] = ary[i]
end
end | ruby | def init_with_ary(ary)
@tuple = Array.new(ary.size)
@tuple.size.times do |i|
@tuple[i] = ary[i]
end
end | [
"def",
"init_with_ary",
"(",
"ary",
")",
"@tuple",
"=",
"Array",
".",
"new",
"(",
"ary",
".",
"size",
")",
"@tuple",
".",
"size",
".",
"times",
"do",
"|",
"i",
"|",
"@tuple",
"[",
"i",
"]",
"=",
"ary",
"[",
"i",
"]",
"end",
"end"
] | Munges +ary+ into a valid Tuple. | [
"Munges",
"+",
"ary",
"+",
"into",
"a",
"valid",
"Tuple",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rinda/rinda.rb#L107-L112 |
1,687 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rinda/rinda.rb | Rinda.Tuple.init_with_hash | def init_with_hash(hash)
@tuple = Hash.new
hash.each do |k, v|
raise InvalidHashTupleKey unless String === k
@tuple[k] = v
end
end | ruby | def init_with_hash(hash)
@tuple = Hash.new
hash.each do |k, v|
raise InvalidHashTupleKey unless String === k
@tuple[k] = v
end
end | [
"def",
"init_with_hash",
"(",
"hash",
")",
"@tuple",
"=",
"Hash",
".",
"new",
"hash",
".",
"each",
"do",
"|",
"k",
",",
"v",
"|",
"raise",
"InvalidHashTupleKey",
"unless",
"String",
"===",
"k",
"@tuple",
"[",
"k",
"]",
"=",
"v",
"end",
"end"
] | Ensures +hash+ is a valid Tuple. | [
"Ensures",
"+",
"hash",
"+",
"is",
"a",
"valid",
"Tuple",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rinda/rinda.rb#L117-L123 |
1,688 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/xsd/datatypes.rb | XSD.XSDFloat.narrow32bit | def narrow32bit(f)
if f.nan? || f.infinite?
f
elsif f.abs < MIN_POSITIVE_SINGLE
XSDFloat.positive?(f) ? POSITIVE_ZERO : NEGATIVE_ZERO
else
f
end
end | ruby | def narrow32bit(f)
if f.nan? || f.infinite?
f
elsif f.abs < MIN_POSITIVE_SINGLE
XSDFloat.positive?(f) ? POSITIVE_ZERO : NEGATIVE_ZERO
else
f
end
end | [
"def",
"narrow32bit",
"(",
"f",
")",
"if",
"f",
".",
"nan?",
"||",
"f",
".",
"infinite?",
"f",
"elsif",
"f",
".",
"abs",
"<",
"MIN_POSITIVE_SINGLE",
"XSDFloat",
".",
"positive?",
"(",
"f",
")",
"?",
"POSITIVE_ZERO",
":",
"NEGATIVE_ZERO",
"else",
"f",
"... | Convert to single-precision 32-bit floating point value. | [
"Convert",
"to",
"single",
"-",
"precision",
"32",
"-",
"bit",
"floating",
"point",
"value",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/xsd/datatypes.rb#L352-L360 |
1,689 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/xsd/datatypes.rb | XSD.XSDHexBinary.set_encoded | def set_encoded(value)
if /^[0-9a-fA-F]*$/ !~ value
raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
end
@data = String.new(value).strip
@is_nil = false
end | ruby | def set_encoded(value)
if /^[0-9a-fA-F]*$/ !~ value
raise ValueSpaceError.new("#{ type }: cannot accept '#{ value }'.")
end
@data = String.new(value).strip
@is_nil = false
end | [
"def",
"set_encoded",
"(",
"value",
")",
"if",
"/",
"/",
"!~",
"value",
"raise",
"ValueSpaceError",
".",
"new",
"(",
"\"#{ type }: cannot accept '#{ value }'.\"",
")",
"end",
"@data",
"=",
"String",
".",
"new",
"(",
"value",
")",
".",
"strip",
"@is_nil",
"="... | String in Ruby could be a binary. | [
"String",
"in",
"Ruby",
"could",
"be",
"a",
"binary",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/xsd/datatypes.rb#L880-L886 |
1,690 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/rescuable.rb | ActiveSupport.Rescuable.rescue_with_handler | def rescue_with_handler(exception)
if handler = handler_for_rescue(exception)
handler.arity != 0 ? handler.call(exception) : handler.call
true # don't rely on the return value of the handler
end
end | ruby | def rescue_with_handler(exception)
if handler = handler_for_rescue(exception)
handler.arity != 0 ? handler.call(exception) : handler.call
true # don't rely on the return value of the handler
end
end | [
"def",
"rescue_with_handler",
"(",
"exception",
")",
"if",
"handler",
"=",
"handler_for_rescue",
"(",
"exception",
")",
"handler",
".",
"arity",
"!=",
"0",
"?",
"handler",
".",
"call",
"(",
"exception",
")",
":",
"handler",
".",
"call",
"true",
"# don't rely... | Tries to rescue the exception by looking up and calling a registered handler. | [
"Tries",
"to",
"rescue",
"the",
"exception",
"by",
"looking",
"up",
"and",
"calling",
"a",
"registered",
"handler",
"."
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/rescuable.rb#L71-L76 |
1,691 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/preprocess.rb | SM.PreProcess.handle | def handle(text)
text.gsub!(/^([ \t#]*):(\w+):\s*(.+)?\n/) do
prefix = $1
directive = $2.downcase
param = $3
case directive
when "include"
filename = param.split[0]
include_file(filename, prefix)
else
yield(directive, param)
... | ruby | def handle(text)
text.gsub!(/^([ \t#]*):(\w+):\s*(.+)?\n/) do
prefix = $1
directive = $2.downcase
param = $3
case directive
when "include"
filename = param.split[0]
include_file(filename, prefix)
else
yield(directive, param)
... | [
"def",
"handle",
"(",
"text",
")",
"text",
".",
"gsub!",
"(",
"/",
"\\t",
"\\w",
"\\s",
"\\n",
"/",
")",
"do",
"prefix",
"=",
"$1",
"directive",
"=",
"$2",
".",
"downcase",
"param",
"=",
"$3",
"case",
"directive",
"when",
"\"include\"",
"filename",
"... | Look for common options in a chunk of text. Options that
we don't handle are passed back to our caller
as |directive, param| | [
"Look",
"for",
"common",
"options",
"in",
"a",
"chunk",
"of",
"text",
".",
"Options",
"that",
"we",
"don",
"t",
"handle",
"are",
"passed",
"back",
"to",
"our",
"caller",
"as",
"|directive",
"param|"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/preprocess.rb#L20-L35 |
1,692 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/preprocess.rb | SM.PreProcess.include_file | def include_file(name, indent)
if (full_name = find_include_file(name))
content = File.open(full_name) {|f| f.read}
# strip leading '#'s, but only if all lines start with them
if content =~ /^[^#]/
content.gsub(/^/, indent)
else
content.gsub(/^#?/, indent)
... | ruby | def include_file(name, indent)
if (full_name = find_include_file(name))
content = File.open(full_name) {|f| f.read}
# strip leading '#'s, but only if all lines start with them
if content =~ /^[^#]/
content.gsub(/^/, indent)
else
content.gsub(/^#?/, indent)
... | [
"def",
"include_file",
"(",
"name",
",",
"indent",
")",
"if",
"(",
"full_name",
"=",
"find_include_file",
"(",
"name",
")",
")",
"content",
"=",
"File",
".",
"open",
"(",
"full_name",
")",
"{",
"|",
"f",
"|",
"f",
".",
"read",
"}",
"# strip leading '#'... | Include a file, indenting it correctly | [
"Include",
"a",
"file",
"indenting",
"it",
"correctly"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/preprocess.rb#L43-L56 |
1,693 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/preprocess.rb | SM.PreProcess.find_include_file | def find_include_file(name)
to_search = [ File.dirname(@input_file_name) ].concat @include_path
to_search.each do |dir|
full_name = File.join(dir, name)
stat = File.stat(full_name) rescue next
return full_name if stat.readable?
end
nil
end | ruby | def find_include_file(name)
to_search = [ File.dirname(@input_file_name) ].concat @include_path
to_search.each do |dir|
full_name = File.join(dir, name)
stat = File.stat(full_name) rescue next
return full_name if stat.readable?
end
nil
end | [
"def",
"find_include_file",
"(",
"name",
")",
"to_search",
"=",
"[",
"File",
".",
"dirname",
"(",
"@input_file_name",
")",
"]",
".",
"concat",
"@include_path",
"to_search",
".",
"each",
"do",
"|",
"dir",
"|",
"full_name",
"=",
"File",
".",
"join",
"(",
"... | Look for the given file in the directory containing the current
file, and then in each of the directories specified in the
RDOC_INCLUDE path | [
"Look",
"for",
"the",
"given",
"file",
"in",
"the",
"directory",
"containing",
"the",
"current",
"file",
"and",
"then",
"in",
"each",
"of",
"the",
"directories",
"specified",
"in",
"the",
"RDOC_INCLUDE",
"path"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/markup/simple_markup/preprocess.rb#L62-L70 |
1,694 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.parse_subprogram | def parse_subprogram(subprogram, params, comment, code,
before_contains=nil, function=nil, prefix=nil)
subprogram.singleton = false
prefix = "" if !prefix
arguments = params.sub(/\(/, "").sub(/\)/, "").split(",") if params
args_comment, params_opt =
find_argume... | ruby | def parse_subprogram(subprogram, params, comment, code,
before_contains=nil, function=nil, prefix=nil)
subprogram.singleton = false
prefix = "" if !prefix
arguments = params.sub(/\(/, "").sub(/\)/, "").split(",") if params
args_comment, params_opt =
find_argume... | [
"def",
"parse_subprogram",
"(",
"subprogram",
",",
"params",
",",
"comment",
",",
"code",
",",
"before_contains",
"=",
"nil",
",",
"function",
"=",
"nil",
",",
"prefix",
"=",
"nil",
")",
"subprogram",
".",
"singleton",
"=",
"false",
"prefix",
"=",
"\"\"",
... | End of parse_program_or_module
Parse arguments, comment, code of subroutine and function.
Return AnyMethod object. | [
"End",
"of",
"parse_program_or_module"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1007-L1034 |
1,695 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.collect_first_comment | def collect_first_comment(body)
comment = ""
not_comment = ""
comment_start = false
comment_end = false
body.split("\n").each{ |line|
if comment_end
not_comment << line
not_comment << "\n"
elsif /^\s*?!\s?(.*)$/i =~ line
comment_start = true
... | ruby | def collect_first_comment(body)
comment = ""
not_comment = ""
comment_start = false
comment_end = false
body.split("\n").each{ |line|
if comment_end
not_comment << line
not_comment << "\n"
elsif /^\s*?!\s?(.*)$/i =~ line
comment_start = true
... | [
"def",
"collect_first_comment",
"(",
"body",
")",
"comment",
"=",
"\"\"",
"not_comment",
"=",
"\"\"",
"comment_start",
"=",
"false",
"comment_end",
"=",
"false",
"body",
".",
"split",
"(",
"\"\\n\"",
")",
".",
"each",
"{",
"|",
"line",
"|",
"if",
"comment_... | Collect comment for file entity | [
"Collect",
"comment",
"for",
"file",
"entity"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1039-L1061 |
1,696 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.find_namelists | def find_namelists(text, before_contains=nil)
return nil if !text
result = ""
lines = "#{text}"
before_contains = "" if !before_contains
while lines =~ /^\s*?namelist\s+\/\s*?(\w+)\s*?\/([\s\w\,]+)$/i
lines = $~.post_match
nml_comment = COMMENTS_ARE_UPPER ?
fin... | ruby | def find_namelists(text, before_contains=nil)
return nil if !text
result = ""
lines = "#{text}"
before_contains = "" if !before_contains
while lines =~ /^\s*?namelist\s+\/\s*?(\w+)\s*?\/([\s\w\,]+)$/i
lines = $~.post_match
nml_comment = COMMENTS_ARE_UPPER ?
fin... | [
"def",
"find_namelists",
"(",
"text",
",",
"before_contains",
"=",
"nil",
")",
"return",
"nil",
"if",
"!",
"text",
"result",
"=",
"\"\"",
"lines",
"=",
"\"#{text}\"",
"before_contains",
"=",
"\"\"",
"if",
"!",
"before_contains",
"while",
"lines",
"=~",
"/",
... | Return comments of definitions of namelists | [
"Return",
"comments",
"of",
"definitions",
"of",
"namelists"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1123-L1142 |
1,697 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.find_comments | def find_comments text
return "" unless text
lines = text.split("\n")
lines.reverse! if COMMENTS_ARE_UPPER
comment_block = Array.new
lines.each do |line|
break if line =~ /^\s*?\w/ || line =~ /^\s*?$/
if COMMENTS_ARE_UPPER
comment_block.unshift line.sub(/^\s*?!\s?... | ruby | def find_comments text
return "" unless text
lines = text.split("\n")
lines.reverse! if COMMENTS_ARE_UPPER
comment_block = Array.new
lines.each do |line|
break if line =~ /^\s*?\w/ || line =~ /^\s*?$/
if COMMENTS_ARE_UPPER
comment_block.unshift line.sub(/^\s*?!\s?... | [
"def",
"find_comments",
"text",
"return",
"\"\"",
"unless",
"text",
"lines",
"=",
"text",
".",
"split",
"(",
"\"\\n\"",
")",
"lines",
".",
"reverse!",
"if",
"COMMENTS_ARE_UPPER",
"comment_block",
"=",
"Array",
".",
"new",
"lines",
".",
"each",
"do",
"|",
"... | Comments just after module or subprogram, or arguments are
returned. If "COMMENTS_ARE_UPPER" is true, comments just before
modules or subprograms are returned | [
"Comments",
"just",
"after",
"module",
"or",
"subprogram",
"or",
"arguments",
"are",
"returned",
".",
"If",
"COMMENTS_ARE_UPPER",
"is",
"true",
"comments",
"just",
"before",
"modules",
"or",
"subprograms",
"are",
"returned"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1149-L1165 |
1,698 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.initialize_public_method | def initialize_public_method(method, parent)
return if !method || !parent
new_meth = AnyMethod.new("External Alias for module", method.name)
new_meth.singleton = method.singleton
new_meth.params = method.params.clone
new_meth.comment = remove_trailing_alias(method.comment.cl... | ruby | def initialize_public_method(method, parent)
return if !method || !parent
new_meth = AnyMethod.new("External Alias for module", method.name)
new_meth.singleton = method.singleton
new_meth.params = method.params.clone
new_meth.comment = remove_trailing_alias(method.comment.cl... | [
"def",
"initialize_public_method",
"(",
"method",
",",
"parent",
")",
"return",
"if",
"!",
"method",
"||",
"!",
"parent",
"new_meth",
"=",
"AnyMethod",
".",
"new",
"(",
"\"External Alias for module\"",
",",
"method",
".",
"name",
")",
"new_meth",
".",
"singlet... | Create method for internal alias | [
"Create",
"method",
"for",
"internal",
"alias"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1177-L1187 |
1,699 | ThoughtWorksStudios/oauth2_provider | tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb | RDoc.Fortran95parser.initialize_external_method | def initialize_external_method(new, old, params, file, comment, token=nil,
internal=nil, nolink=nil)
return nil unless new || old
if internal
external_alias_header = "#{INTERNAL_ALIAS_MES} "
external_alias_text = external_alias_header + old
elsif ... | ruby | def initialize_external_method(new, old, params, file, comment, token=nil,
internal=nil, nolink=nil)
return nil unless new || old
if internal
external_alias_header = "#{INTERNAL_ALIAS_MES} "
external_alias_text = external_alias_header + old
elsif ... | [
"def",
"initialize_external_method",
"(",
"new",
",",
"old",
",",
"params",
",",
"file",
",",
"comment",
",",
"token",
"=",
"nil",
",",
"internal",
"=",
"nil",
",",
"nolink",
"=",
"nil",
")",
"return",
"nil",
"unless",
"new",
"||",
"old",
"if",
"intern... | Create method for external alias
If argument "internal" is true, file is ignored. | [
"Create",
"method",
"for",
"external",
"alias"
] | d54702f194edd05389968cf8947465860abccc5d | https://github.com/ThoughtWorksStudios/oauth2_provider/blob/d54702f194edd05389968cf8947465860abccc5d/tools/jruby-1.5.1/lib/ruby/1.8/rdoc/parsers/parse_f95.rb#L1194-L1220 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.