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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
15,900 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/network_segment.rb | JSS.NetworkSegment.override_departments= | def override_departments=(newval)
raise JSS::InvalidDataError, 'New value must be boolean true or false' unless JSS::TRUE_FALSE.include? newval
@override_departments = newval
@need_to_update = true
end | ruby | def override_departments=(newval)
raise JSS::InvalidDataError, 'New value must be boolean true or false' unless JSS::TRUE_FALSE.include? newval
@override_departments = newval
@need_to_update = true
end | [
"def",
"override_departments",
"=",
"(",
"newval",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'New value must be boolean true or false'",
"unless",
"JSS",
"::",
"TRUE_FALSE",
".",
"include?",
"newval",
"@override_departments",
"=",
"newval",
"@need_to_update",
... | set the override depts option
@param newval[Boolean] the new setting
@return [void] | [
"set",
"the",
"override",
"depts",
"option"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/network_segment.rb#L385-L389 |
15,901 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/network_segment.rb | JSS.NetworkSegment.distribution_point= | def distribution_point=(newval)
new = JSS::DistributionPoint.all.select { |b| (b[:id] == newval) || (b[:name] == newval) }[0]
raise JSS::MissingDataError, "No distribution_point matching '#{newval}' in the JSS" unless new
@distribution_point = new[:name]
@need_to_update = true
end | ruby | def distribution_point=(newval)
new = JSS::DistributionPoint.all.select { |b| (b[:id] == newval) || (b[:name] == newval) }[0]
raise JSS::MissingDataError, "No distribution_point matching '#{newval}' in the JSS" unless new
@distribution_point = new[:name]
@need_to_update = true
end | [
"def",
"distribution_point",
"=",
"(",
"newval",
")",
"new",
"=",
"JSS",
"::",
"DistributionPoint",
".",
"all",
".",
"select",
"{",
"|",
"b",
"|",
"(",
"b",
"[",
":id",
"]",
"==",
"newval",
")",
"||",
"(",
"b",
"[",
":name",
"]",
"==",
"newval",
... | set the distribution_point
@param newval[String, Integer] the new dist. point by name or id, must be in the JSS
@return [void] | [
"set",
"the",
"distribution_point"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/network_segment.rb#L397-L402 |
15,902 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/network_segment.rb | JSS.NetworkSegment.netboot_server= | def netboot_server=(newval)
new = JSS::NetbootServer.all.select { |b| (b[:id] == newval) || (b[:name] == newval) }[0]
raise JSS::MissingDataError, "No netboot_server matching '#{newval}' in the JSS" unless new
@netboot_server = new[:name]
@need_to_update = true
end | ruby | def netboot_server=(newval)
new = JSS::NetbootServer.all.select { |b| (b[:id] == newval) || (b[:name] == newval) }[0]
raise JSS::MissingDataError, "No netboot_server matching '#{newval}' in the JSS" unless new
@netboot_server = new[:name]
@need_to_update = true
end | [
"def",
"netboot_server",
"=",
"(",
"newval",
")",
"new",
"=",
"JSS",
"::",
"NetbootServer",
".",
"all",
".",
"select",
"{",
"|",
"b",
"|",
"(",
"b",
"[",
":id",
"]",
"==",
"newval",
")",
"||",
"(",
"b",
"[",
":name",
"]",
"==",
"newval",
")",
"... | set the netboot_server
@param newval[String, Integer] the new netboot server by name or id, must be in the JSS
@return [void] | [
"set",
"the",
"netboot_server"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/network_segment.rb#L410-L415 |
15,903 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/network_segment.rb | JSS.NetworkSegment.swu_server= | def swu_server=(newval)
new = JSS::SoftwareUpdateServer.all.select { |b| (b[:id] == newval) || (b[:name] == newval) }[0]
raise JSS::MissingDataError, "No swu_server matching '#{newval}' in the JSS" unless new
@swu_server = new[:name]
@need_to_update = true
end | ruby | def swu_server=(newval)
new = JSS::SoftwareUpdateServer.all.select { |b| (b[:id] == newval) || (b[:name] == newval) }[0]
raise JSS::MissingDataError, "No swu_server matching '#{newval}' in the JSS" unless new
@swu_server = new[:name]
@need_to_update = true
end | [
"def",
"swu_server",
"=",
"(",
"newval",
")",
"new",
"=",
"JSS",
"::",
"SoftwareUpdateServer",
".",
"all",
".",
"select",
"{",
"|",
"b",
"|",
"(",
"b",
"[",
":id",
"]",
"==",
"newval",
")",
"||",
"(",
"b",
"[",
":name",
"]",
"==",
"newval",
")",
... | set the sw update server
@param newval[String, Integer] the new server by name or id, must be in the JSS
@return [void] | [
"set",
"the",
"sw",
"update",
"server"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/network_segment.rb#L423-L428 |
15,904 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/network_segment.rb | JSS.NetworkSegment.set_ip_range | def set_ip_range(starting_address: nil, ending_address: nil, mask: nil, cidr: nil)
range = self.class.ip_range(
starting_address: starting_address,
ending_address: ending_address,
mask: mask,
cidr: cidr
)
@starting_address = range.first
@ending_address = range.las... | ruby | def set_ip_range(starting_address: nil, ending_address: nil, mask: nil, cidr: nil)
range = self.class.ip_range(
starting_address: starting_address,
ending_address: ending_address,
mask: mask,
cidr: cidr
)
@starting_address = range.first
@ending_address = range.las... | [
"def",
"set_ip_range",
"(",
"starting_address",
":",
"nil",
",",
"ending_address",
":",
"nil",
",",
"mask",
":",
"nil",
",",
"cidr",
":",
"nil",
")",
"range",
"=",
"self",
".",
"class",
".",
"ip_range",
"(",
"starting_address",
":",
"starting_address",
","... | set a new starting and ending addr at the same time.
@see_also NetworkSegment.ip_range for how to specify the starting
and ending addresses.
@param starting_address[String] The starting address, possibly masked
@param ending_address[String] The ending address
@param mask[String] The subnet mask to apply to the... | [
"set",
"a",
"new",
"starting",
"and",
"ending",
"addr",
"at",
"the",
"same",
"time",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/network_segment.rb#L485-L495 |
15,905 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/script.rb | JSS.Script.name= | def name=(new_val)
return nil if new_val == @name
new_val = nil if new_val == ''
raise JSS::MissingDataError, "Name can't be empty" unless new_val
raise JSS::AlreadyExistsError, "A #{RSRC_OBJECT_KEY} already exists with the name '#{args[:name]}'" if JSS.send(LIST_METHOD).values.include?
#... | ruby | def name=(new_val)
return nil if new_val == @name
new_val = nil if new_val == ''
raise JSS::MissingDataError, "Name can't be empty" unless new_val
raise JSS::AlreadyExistsError, "A #{RSRC_OBJECT_KEY} already exists with the name '#{args[:name]}'" if JSS.send(LIST_METHOD).values.include?
#... | [
"def",
"name",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"new_val",
"==",
"@name",
"new_val",
"=",
"nil",
"if",
"new_val",
"==",
"''",
"raise",
"JSS",
"::",
"MissingDataError",
",",
"\"Name can't be empty\"",
"unless",
"new_val",
"raise",
"JSS",
"::",... | filename=
Change the script's display name
If the filename is the same as the name, the filename will be changed also
@param new_val[String] the new display name
@return [void] | [
"filename",
"=",
"Change",
"the",
"script",
"s",
"display",
"name"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/script.rb#L178-L191 |
15,906 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/script.rb | JSS.Script.os_requirements= | def os_requirements=(new_val)
### nil should be an empty array
new_val = [] if new_val.to_s.empty?
### if any value starts with >=, expand it
case new_val
when String
new_val = JSS.expand_min_os(new_val) if new_val =~ /^>=/
when Array
new_val.map! { |a| a =~ /^>=/ ? ... | ruby | def os_requirements=(new_val)
### nil should be an empty array
new_val = [] if new_val.to_s.empty?
### if any value starts with >=, expand it
case new_val
when String
new_val = JSS.expand_min_os(new_val) if new_val =~ /^>=/
when Array
new_val.map! { |a| a =~ /^>=/ ? ... | [
"def",
"os_requirements",
"=",
"(",
"new_val",
")",
"### nil should be an empty array",
"new_val",
"=",
"[",
"]",
"if",
"new_val",
".",
"to_s",
".",
"empty?",
"### if any value starts with >=, expand it",
"case",
"new_val",
"when",
"String",
"new_val",
"=",
"JSS",
"... | name=
Change the os_requirements
Minumum OS's can be specified as a string using the notation ">=10.6.7"
See the {JSS.expand_min_os} method for details.
@param new_val[String, Array<String>] the new os requirements as a comma-separted String or an Array of Strings
@return [void]
@example String value
myscr... | [
"name",
"=",
"Change",
"the",
"os_requirements"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/script.rb#L212-L231 |
15,907 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/script.rb | JSS.Script.priority= | def priority=(new_val)
return nil if new_val == @priority
new_val = DEFAULT_PRIORITY if new_val.nil? || (new_val == '')
raise JSS::InvalidDataError, ":priority must be one of: #{PRIORITIES.join ', '}" unless PRIORITIES.include? new_val
@priority = new_val
@need_to_update = true
end | ruby | def priority=(new_val)
return nil if new_val == @priority
new_val = DEFAULT_PRIORITY if new_val.nil? || (new_val == '')
raise JSS::InvalidDataError, ":priority must be one of: #{PRIORITIES.join ', '}" unless PRIORITIES.include? new_val
@priority = new_val
@need_to_update = true
end | [
"def",
"priority",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"new_val",
"==",
"@priority",
"new_val",
"=",
"DEFAULT_PRIORITY",
"if",
"new_val",
".",
"nil?",
"||",
"(",
"new_val",
"==",
"''",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"\":pr... | os_requirements=
Change the priority of this script
@param new_val[Integer] the new priority, which must be one of {PRIORITIES}
@return [void] | [
"os_requirements",
"=",
"Change",
"the",
"priority",
"of",
"this",
"script"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/script.rb#L239-L245 |
15,908 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/script.rb | JSS.Script.parameters= | def parameters=(new_val)
return nil if new_val == @parameters
new_val = {} if new_val.nil? || (new_val == '')
### check the values
raise JSS::InvalidDataError, ':parameters must be a Hash with keys :parameter4 thru :parameter11' unless \
new_val.is_a?(Hash) && ((new_val.keys & PARAMETER... | ruby | def parameters=(new_val)
return nil if new_val == @parameters
new_val = {} if new_val.nil? || (new_val == '')
### check the values
raise JSS::InvalidDataError, ':parameters must be a Hash with keys :parameter4 thru :parameter11' unless \
new_val.is_a?(Hash) && ((new_val.keys & PARAMETER... | [
"def",
"parameters",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"new_val",
"==",
"@parameters",
"new_val",
"=",
"{",
"}",
"if",
"new_val",
".",
"nil?",
"||",
"(",
"new_val",
"==",
"''",
")",
"### check the values",
"raise",
"JSS",
"::",
"InvalidDataE... | notes=
Replace all the script parameters at once.
This will replace the entire set with the hash provided.
@param new_val[Hash] the Hash keys must exist in {PARAMETER_KEYS}
@return [void] | [
"notes",
"=",
"Replace",
"all",
"the",
"script",
"parameters",
"at",
"once",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/script.rb#L283-L296 |
15,909 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/script.rb | JSS.Script.set_parameter | def set_parameter(param_num, new_val)
raise JSS::NoSuchItemError, 'Parameter numbers must be from 4-11' unless (4..11).cover? param_num
pkey = "parameter#{param_num}".to_sym
raise JSS::InvalidDataError, 'parameter values must be strings or nil' unless new_val.nil? || new_val.is_a?(String)
return... | ruby | def set_parameter(param_num, new_val)
raise JSS::NoSuchItemError, 'Parameter numbers must be from 4-11' unless (4..11).cover? param_num
pkey = "parameter#{param_num}".to_sym
raise JSS::InvalidDataError, 'parameter values must be strings or nil' unless new_val.nil? || new_val.is_a?(String)
return... | [
"def",
"set_parameter",
"(",
"param_num",
",",
"new_val",
")",
"raise",
"JSS",
"::",
"NoSuchItemError",
",",
"'Parameter numbers must be from 4-11'",
"unless",
"(",
"4",
"..",
"11",
")",
".",
"cover?",
"param_num",
"pkey",
"=",
"\"parameter#{param_num}\"",
".",
"t... | parameters=
Change one of the stored parameters
@param param_num[Integer] which param are we setting? must be 4..11
@param new_val[String] the new value for the parameter
@return [void] | [
"parameters",
"=",
"Change",
"one",
"of",
"the",
"stored",
"parameters"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/script.rb#L306-L313 |
15,910 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/script.rb | JSS.Script.script_contents= | def script_contents=(new_val)
new_code = case new_val
when String
if new_val.start_with? '/'
Pathname.new(new_val).read
else
new_val
end # if
when Pathname
new_va... | ruby | def script_contents=(new_val)
new_code = case new_val
when String
if new_val.start_with? '/'
Pathname.new(new_val).read
else
new_val
end # if
when Pathname
new_va... | [
"def",
"script_contents",
"=",
"(",
"new_val",
")",
"new_code",
"=",
"case",
"new_val",
"when",
"String",
"if",
"new_val",
".",
"start_with?",
"'/'",
"Pathname",
".",
"new",
"(",
"new_val",
")",
".",
"read",
"else",
"new_val",
"end",
"# if",
"when",
"Pathn... | Change the executable code of this script.
If the arg is a Pathname instance, or a String starting with "/"
Then the arg is assumed to be a file from which to read the code.
Otherwise it should be a String with the code itself, and it must start with '#!"
After doing this, use {#create} or {#update} to write it ... | [
"Change",
"the",
"executable",
"code",
"of",
"this",
"script",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/script.rb#L329-L347 |
15,911 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/script.rb | JSS.Script.delete_master_file | def delete_master_file(rw_pw, unmount = true)
file = JSS::DistributionPoint.master_distribution_point.mount(rw_pw, :rw) + "#{DIST_POINT_SCRIPTS_FOLDER}/#{@filename}"
if file.exist?
file.delete
did_it = true
else
did_it = false
end # if exists
JSS::DistributionPoint.... | ruby | def delete_master_file(rw_pw, unmount = true)
file = JSS::DistributionPoint.master_distribution_point.mount(rw_pw, :rw) + "#{DIST_POINT_SCRIPTS_FOLDER}/#{@filename}"
if file.exist?
file.delete
did_it = true
else
did_it = false
end # if exists
JSS::DistributionPoint.... | [
"def",
"delete_master_file",
"(",
"rw_pw",
",",
"unmount",
"=",
"true",
")",
"file",
"=",
"JSS",
"::",
"DistributionPoint",
".",
"master_distribution_point",
".",
"mount",
"(",
"rw_pw",
",",
":rw",
")",
"+",
"\"#{DIST_POINT_SCRIPTS_FOLDER}/#{@filename}\"",
"if",
"... | upload
Delete the filename from the master distribution point, if it exists.
If you'll be uploading several files you can specify unmount as false, and do it manually when all
are finished.
@param rw_pw[String] the password for the read/write account on the master Distribution Point
@param unmount[Boolean] whet... | [
"upload",
"Delete",
"the",
"filename",
"from",
"the",
"master",
"distribution",
"point",
"if",
"it",
"exists",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/script.rb#L384-L394 |
15,912 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/script.rb | JSS.Script.run | def run(opts = {})
opts[:target] ||= '/'
opts[:p1] ||= @parameters[:parameter4]
opts[:p2] ||= @parameters[:parameter5]
opts[:p3] ||= @parameters[:parameter6]
opts[:p4] ||= @parameters[:parameter7]
opts[:p5] ||= @parameters[:parameter8]
opts[:p6] ||= @parameters[:parameter9]
... | ruby | def run(opts = {})
opts[:target] ||= '/'
opts[:p1] ||= @parameters[:parameter4]
opts[:p2] ||= @parameters[:parameter5]
opts[:p3] ||= @parameters[:parameter6]
opts[:p4] ||= @parameters[:parameter7]
opts[:p5] ||= @parameters[:parameter8]
opts[:p6] ||= @parameters[:parameter9]
... | [
"def",
"run",
"(",
"opts",
"=",
"{",
"}",
")",
"opts",
"[",
":target",
"]",
"||=",
"'/'",
"opts",
"[",
":p1",
"]",
"||=",
"@parameters",
"[",
":parameter4",
"]",
"opts",
"[",
":p2",
"]",
"||=",
"@parameters",
"[",
":parameter5",
"]",
"opts",
"[",
"... | Run this script on the current machine using the "jamf runScript" command.
If the script code is available in the {#script_contents} attribute, then that
code is saved to a tmp file, and executed. Otherwise, the script is assumed
to be stored on the distribution point.
If the dist. point has http downloads enable... | [
"Run",
"this",
"script",
"on",
"the",
"current",
"machine",
"using",
"the",
"jamf",
"runScript",
"command",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/script.rb#L450-L547 |
15,913 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/script.rb | JSS.Script.rest_xml | def rest_xml
doc = REXML::Document.new
scpt = doc.add_element 'script'
scpt.add_element('filename').text = @filename
scpt.add_element('id').text = @id
scpt.add_element('info').text = @info
scpt.add_element('name').text = @name
scpt.add_element('notes').text = @notes
scpt... | ruby | def rest_xml
doc = REXML::Document.new
scpt = doc.add_element 'script'
scpt.add_element('filename').text = @filename
scpt.add_element('id').text = @id
scpt.add_element('info').text = @info
scpt.add_element('name').text = @name
scpt.add_element('notes').text = @notes
scpt... | [
"def",
"rest_xml",
"doc",
"=",
"REXML",
"::",
"Document",
".",
"new",
"scpt",
"=",
"doc",
".",
"add_element",
"'script'",
"scpt",
".",
"add_element",
"(",
"'filename'",
")",
".",
"text",
"=",
"@filename",
"scpt",
".",
"add_element",
"(",
"'id'",
")",
"."... | Return the xml for creating or updating this script in the JSS | [
"Return",
"the",
"xml",
"for",
"creating",
"or",
"updating",
"this",
"script",
"in",
"the",
"JSS"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/script.rb#L564-L587 |
15,914 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/peripheral_type.rb | JSS.PeripheralType.set_field | def set_field(order, field = {})
raise JSS::NoSuchItemError, "No field with number '#{order}'. Use #append_field, #prepend_field, or #insert_field" unless @fields[order]
field_ok? field
@fields[order] = field
@need_to_update = true
end | ruby | def set_field(order, field = {})
raise JSS::NoSuchItemError, "No field with number '#{order}'. Use #append_field, #prepend_field, or #insert_field" unless @fields[order]
field_ok? field
@fields[order] = field
@need_to_update = true
end | [
"def",
"set_field",
"(",
"order",
",",
"field",
"=",
"{",
"}",
")",
"raise",
"JSS",
"::",
"NoSuchItemError",
",",
"\"No field with number '#{order}'. Use #append_field, #prepend_field, or #insert_field\"",
"unless",
"@fields",
"[",
"order",
"]",
"field_ok?",
"field",
"@... | Replace the details of one specific field.
The order must already exist. Otherwise use
{#append_field}, {#prepend_field}, or {#insert_field}
@param order[Integer] which field are we replacing?
@param field[Hash] the new field data
@return [void] | [
"Replace",
"the",
"details",
"of",
"one",
"specific",
"field",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/peripheral_type.rb#L172-L177 |
15,915 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/peripheral_type.rb | JSS.PeripheralType.insert_field | def insert_field(order,field = {})
field_ok? field
@fields.insert((order -1), field)
order_fields
@need_to_update = true
end | ruby | def insert_field(order,field = {})
field_ok? field
@fields.insert((order -1), field)
order_fields
@need_to_update = true
end | [
"def",
"insert_field",
"(",
"order",
",",
"field",
"=",
"{",
"}",
")",
"field_ok?",
"field",
"@fields",
".",
"insert",
"(",
"(",
"order",
"-",
"1",
")",
",",
"field",
")",
"order_fields",
"@need_to_update",
"=",
"true",
"end"
] | Add a new field to the middle of the fields Array.
@param order[Integer] where does the new field go?
@param field[Hash] the new field data
@return [void] | [
"Add",
"a",
"new",
"field",
"to",
"the",
"middle",
"of",
"the",
"fields",
"Array",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/peripheral_type.rb#L216-L221 |
15,916 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/peripheral_type.rb | JSS.PeripheralType.delete_field | def delete_field(order)
if @fields[order]
raise JSS::MissingDataError, "Fields can't be empty" if @fields.count == 1
@fields.delete_at index
order_fields
@need_to_update = true
end
end | ruby | def delete_field(order)
if @fields[order]
raise JSS::MissingDataError, "Fields can't be empty" if @fields.count == 1
@fields.delete_at index
order_fields
@need_to_update = true
end
end | [
"def",
"delete_field",
"(",
"order",
")",
"if",
"@fields",
"[",
"order",
"]",
"raise",
"JSS",
"::",
"MissingDataError",
",",
"\"Fields can't be empty\"",
"if",
"@fields",
".",
"count",
"==",
"1",
"@fields",
".",
"delete_at",
"index",
"order_fields",
"@need_to_up... | Remove a field from the array of fields.
@param order[Integer] which field to remove?
@return [void] | [
"Remove",
"a",
"field",
"from",
"the",
"array",
"of",
"fields",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/peripheral_type.rb#L230-L237 |
15,917 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/peripheral_type.rb | JSS.PeripheralType.field_ok? | def field_ok?(field)
raise JSS::InvalidDataError, "Field elements must be hashes with :name, :type, and possibly :choices" unless field.kind_of? Hash
raise JSS::InvalidDataError, "Fields require names" if field[:name].to_s.empty?
raise JSS::InvalidDataError, "Fields :type must be one of: :#{FIELD_TYPE... | ruby | def field_ok?(field)
raise JSS::InvalidDataError, "Field elements must be hashes with :name, :type, and possibly :choices" unless field.kind_of? Hash
raise JSS::InvalidDataError, "Fields require names" if field[:name].to_s.empty?
raise JSS::InvalidDataError, "Fields :type must be one of: :#{FIELD_TYPE... | [
"def",
"field_ok?",
"(",
"field",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"\"Field elements must be hashes with :name, :type, and possibly :choices\"",
"unless",
"field",
".",
"kind_of?",
"Hash",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"\"Fields require n... | is a Hash of field data OK for use in the JSS?
Return true or raise an exception | [
"is",
"a",
"Hash",
"of",
"field",
"data",
"OK",
"for",
"use",
"in",
"the",
"JSS?",
"Return",
"true",
"or",
"raise",
"an",
"exception"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/peripheral_type.rb#L250-L263 |
15,918 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/group.rb | JSS.Group.remove_member | def remove_member(mem)
raise InvalidDataError, "Smart group members can't be changed." if @is_smart
raise InvalidDataError, "Can't remove nil" if mem.nil?
removed = @members.reject! { |mm| [mm[:id], mm[:name], mm[:username]].include? mem }
@need_to_update = true if removed
end | ruby | def remove_member(mem)
raise InvalidDataError, "Smart group members can't be changed." if @is_smart
raise InvalidDataError, "Can't remove nil" if mem.nil?
removed = @members.reject! { |mm| [mm[:id], mm[:name], mm[:username]].include? mem }
@need_to_update = true if removed
end | [
"def",
"remove_member",
"(",
"mem",
")",
"raise",
"InvalidDataError",
",",
"\"Smart group members can't be changed.\"",
"if",
"@is_smart",
"raise",
"InvalidDataError",
",",
"\"Can't remove nil\"",
"if",
"mem",
".",
"nil?",
"removed",
"=",
"@members",
".",
"reject!",
"... | Remove a member by id, or name
@param m[Integer,String] the id or name of the member to remove
@return [void] | [
"Remove",
"a",
"member",
"by",
"id",
"or",
"name"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/group.rb#L339-L344 |
15,919 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/group.rb | JSS.Group.check_member | def check_member(m)
potential_members = self.class::MEMBER_CLASS.map_all_ids_to(:name, api: @api)
if m.to_s =~ /^\d+$/
return { id: m.to_i, name: potential_members[m] } if potential_members.key?(m.to_i)
else
return { name: m, id: potential_members.invert[m] } if potential_members.value... | ruby | def check_member(m)
potential_members = self.class::MEMBER_CLASS.map_all_ids_to(:name, api: @api)
if m.to_s =~ /^\d+$/
return { id: m.to_i, name: potential_members[m] } if potential_members.key?(m.to_i)
else
return { name: m, id: potential_members.invert[m] } if potential_members.value... | [
"def",
"check_member",
"(",
"m",
")",
"potential_members",
"=",
"self",
".",
"class",
"::",
"MEMBER_CLASS",
".",
"map_all_ids_to",
"(",
":name",
",",
"api",
":",
"@api",
")",
"if",
"m",
".",
"to_s",
"=~",
"/",
"\\d",
"/",
"return",
"{",
"id",
":",
"m... | Check that a potential group member is valid in the JSS.
Arg must be an id or name.
An exception is raised if the device doesn't exist.
@return [Hash{:id=>Integer,:name=>String}] the valid id and name | [
"Check",
"that",
"a",
"potential",
"group",
"member",
"is",
"valid",
"in",
"the",
"JSS",
".",
"Arg",
"must",
"be",
"an",
"id",
"or",
"name",
".",
"An",
"exception",
"is",
"raised",
"if",
"the",
"device",
"doesn",
"t",
"exist",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/group.rb#L403-L411 |
15,920 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/patch_title.rb | JSS.PatchTitle.email_notification= | def email_notification=(new_setting)
return if email_notification == new_setting
raise JSS::InvalidDataError, 'New Setting must be boolean true or false' unless JSS::TRUE_FALSE.include? @email_notification = new_setting
@need_to_update = true
end | ruby | def email_notification=(new_setting)
return if email_notification == new_setting
raise JSS::InvalidDataError, 'New Setting must be boolean true or false' unless JSS::TRUE_FALSE.include? @email_notification = new_setting
@need_to_update = true
end | [
"def",
"email_notification",
"=",
"(",
"new_setting",
")",
"return",
"if",
"email_notification",
"==",
"new_setting",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'New Setting must be boolean true or false'",
"unless",
"JSS",
"::",
"TRUE_FALSE",
".",
"include?",
"@em... | Set email notifications on or off
@param new_setting[Boolean] Should email notifications be on or off?
@return [void] | [
"Set",
"email",
"notifications",
"on",
"or",
"off"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/patch_title.rb#L428-L432 |
15,921 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/patch_title.rb | JSS.PatchTitle.web_notification= | def web_notification=(new_setting)
return if web_notification == new_setting
raise JSS::InvalidDataError, 'New Setting must be boolean true or false' unless JSS::TRUE_FALSE.include? @web_notification = new_setting
@need_to_update = true
end | ruby | def web_notification=(new_setting)
return if web_notification == new_setting
raise JSS::InvalidDataError, 'New Setting must be boolean true or false' unless JSS::TRUE_FALSE.include? @web_notification = new_setting
@need_to_update = true
end | [
"def",
"web_notification",
"=",
"(",
"new_setting",
")",
"return",
"if",
"web_notification",
"==",
"new_setting",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'New Setting must be boolean true or false'",
"unless",
"JSS",
"::",
"TRUE_FALSE",
".",
"include?",
"@web_no... | Set web notifications on or off
@param new_setting[Boolean] Should email notifications be on or off?
@return [void] | [
"Set",
"web",
"notifications",
"on",
"or",
"off"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/patch_title.rb#L440-L444 |
15,922 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/patch_title.rb | JSS.PatchTitle.rest_xml | def rest_xml
doc = REXML::Document.new # JSS::APIConnection::XML_HEADER
obj = doc.add_element RSRC_OBJECT_KEY.to_s
obj.add_element('name').text = name
obj.add_element('name_id').text = name_id
obj.add_element('source_id').text = source_id
notifs = obj.add_element 'notifications'
... | ruby | def rest_xml
doc = REXML::Document.new # JSS::APIConnection::XML_HEADER
obj = doc.add_element RSRC_OBJECT_KEY.to_s
obj.add_element('name').text = name
obj.add_element('name_id').text = name_id
obj.add_element('source_id').text = source_id
notifs = obj.add_element 'notifications'
... | [
"def",
"rest_xml",
"doc",
"=",
"REXML",
"::",
"Document",
".",
"new",
"# JSS::APIConnection::XML_HEADER",
"obj",
"=",
"doc",
".",
"add_element",
"RSRC_OBJECT_KEY",
".",
"to_s",
"obj",
".",
"add_element",
"(",
"'name'",
")",
".",
"text",
"=",
"name",
"obj",
"... | Return the REST XML for this title, with the current values,
for saving or updating. | [
"Return",
"the",
"REST",
"XML",
"for",
"this",
"title",
"with",
"the",
"current",
"values",
"for",
"saving",
"or",
"updating",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/patch_title.rb#L495-L513 |
15,923 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/patch_title.rb | JSS.PatchTitle.add_changed_pkg_xml | def add_changed_pkg_xml(obj)
versions_elem = obj.add_element 'versions'
@changed_pkgs.each do |vers|
velem = versions_elem.add_element 'version'
velem.add_element('software_version').text = vers.to_s
pkg = velem.add_element 'package'
# leave am empty package element to remove... | ruby | def add_changed_pkg_xml(obj)
versions_elem = obj.add_element 'versions'
@changed_pkgs.each do |vers|
velem = versions_elem.add_element 'version'
velem.add_element('software_version').text = vers.to_s
pkg = velem.add_element 'package'
# leave am empty package element to remove... | [
"def",
"add_changed_pkg_xml",
"(",
"obj",
")",
"versions_elem",
"=",
"obj",
".",
"add_element",
"'versions'",
"@changed_pkgs",
".",
"each",
"do",
"|",
"vers",
"|",
"velem",
"=",
"versions_elem",
".",
"add_element",
"'version'",
"velem",
".",
"add_element",
"(",
... | rest_xml
add xml for any package changes to patch versions | [
"rest_xml",
"add",
"xml",
"for",
"any",
"package",
"changes",
"to",
"patch",
"versions"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/patch_title.rb#L516-L526 |
15,924 | PixarAnimationStudios/ruby-jss | lib/jss/api_object.rb | JSS.APIObject.validate_object_history_available | def validate_object_history_available
raise JSS::NoSuchItemError, 'Object not yet created' unless @id && @in_jss
raise JSS::InvalidConnectionError, 'Not connected to MySQL' unless JSS::DB_CNX.connected?
raise JSS::UnsupportedError, "Object History access is not supported for #{self.class} objects at... | ruby | def validate_object_history_available
raise JSS::NoSuchItemError, 'Object not yet created' unless @id && @in_jss
raise JSS::InvalidConnectionError, 'Not connected to MySQL' unless JSS::DB_CNX.connected?
raise JSS::UnsupportedError, "Object History access is not supported for #{self.class} objects at... | [
"def",
"validate_object_history_available",
"raise",
"JSS",
"::",
"NoSuchItemError",
",",
"'Object not yet created'",
"unless",
"@id",
"&&",
"@in_jss",
"raise",
"JSS",
"::",
"InvalidConnectionError",
",",
"'Not connected to MySQL'",
"unless",
"JSS",
"::",
"DB_CNX",
".",
... | Raise an exception if object history is not
available for this object
@return [void] | [
"Raise",
"an",
"exception",
"if",
"object",
"history",
"is",
"not",
"available",
"for",
"this",
"object"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object.rb#L887-L893 |
15,925 | PixarAnimationStudios/ruby-jss | lib/jss/api_object.rb | JSS.APIObject.validate_external_init_data | def validate_external_init_data
# data must include all they keys in REQUIRED_DATA_KEYS + VALID_DATA_KEYS
# in either the main hash keys or the :general sub-hash, if it exists
hash_to_check = @init_data[:general] ? @init_data[:general] : @init_data
combined_valid_keys = self.class::REQUIRED_DATA... | ruby | def validate_external_init_data
# data must include all they keys in REQUIRED_DATA_KEYS + VALID_DATA_KEYS
# in either the main hash keys or the :general sub-hash, if it exists
hash_to_check = @init_data[:general] ? @init_data[:general] : @init_data
combined_valid_keys = self.class::REQUIRED_DATA... | [
"def",
"validate_external_init_data",
"# data must include all they keys in REQUIRED_DATA_KEYS + VALID_DATA_KEYS",
"# in either the main hash keys or the :general sub-hash, if it exists",
"hash_to_check",
"=",
"@init_data",
"[",
":general",
"]",
"?",
"@init_data",
"[",
":general",
"]",
... | If we were passed pre-lookedup API data, validate it,
raising exceptions if not valid.
DEPRECATED: pre-lookedup data is never used
and support for it will be going away.
TODO: delete this and all defined VALID_DATA_KEYS
@return [void] | [
"If",
"we",
"were",
"passed",
"pre",
"-",
"lookedup",
"API",
"data",
"validate",
"it",
"raising",
"exceptions",
"if",
"not",
"valid",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object.rb#L905-L920 |
15,926 | PixarAnimationStudios/ruby-jss | lib/jss/api_object.rb | JSS.APIObject.validate_init_for_creation | def validate_init_for_creation(args)
raise JSS::UnsupportedError, "Creating #{self.class::RSRC_LIST_KEY} isn't yet supported. Please use other Casper workflows." unless creatable?
raise JSS::MissingDataError, "You must provide a :name to create a #{self.class::RSRC_OBJECT_KEY}." unless args[:name]
r... | ruby | def validate_init_for_creation(args)
raise JSS::UnsupportedError, "Creating #{self.class::RSRC_LIST_KEY} isn't yet supported. Please use other Casper workflows." unless creatable?
raise JSS::MissingDataError, "You must provide a :name to create a #{self.class::RSRC_OBJECT_KEY}." unless args[:name]
r... | [
"def",
"validate_init_for_creation",
"(",
"args",
")",
"raise",
"JSS",
"::",
"UnsupportedError",
",",
"\"Creating #{self.class::RSRC_LIST_KEY} isn't yet supported. Please use other Casper workflows.\"",
"unless",
"creatable?",
"raise",
"JSS",
"::",
"MissingDataError",
",",
"\"You... | validate_init_data
If we're making a new object in the JSS, make sure we were given
valid data to do so, raise exceptions otherwise.
NOTE: some subclasses may do further validation.
TODO: support for objects that can have duplicate names.
@param args[Hash] The args passed to #initialize
@return [void] | [
"validate_init_data",
"If",
"we",
"re",
"making",
"a",
"new",
"object",
"in",
"the",
"JSS",
"make",
"sure",
"we",
"were",
"given",
"valid",
"data",
"to",
"do",
"so",
"raise",
"exceptions",
"otherwise",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object.rb#L933-L939 |
15,927 | PixarAnimationStudios/ruby-jss | lib/jss/api_object.rb | JSS.APIObject.look_up_object_data | def look_up_object_data(args)
rsrc =
if args[:fetch_rsrc]
args[:fetch_rsrc]
else
# what lookup key are we using?
# TODO: simplify this, see the notes at #find_rsrc_keys
rsrc_key, lookup_value = find_rsrc_keys(args)
"#{self.class::RSRC_BASE}/#{rsrc_... | ruby | def look_up_object_data(args)
rsrc =
if args[:fetch_rsrc]
args[:fetch_rsrc]
else
# what lookup key are we using?
# TODO: simplify this, see the notes at #find_rsrc_keys
rsrc_key, lookup_value = find_rsrc_keys(args)
"#{self.class::RSRC_BASE}/#{rsrc_... | [
"def",
"look_up_object_data",
"(",
"args",
")",
"rsrc",
"=",
"if",
"args",
"[",
":fetch_rsrc",
"]",
"args",
"[",
":fetch_rsrc",
"]",
"else",
"# what lookup key are we using?",
"# TODO: simplify this, see the notes at #find_rsrc_keys",
"rsrc_key",
",",
"lookup_value",
"=",... | Given initialization args, perform an API lookup for an object.
@param args[Hash] The args passed to #initialize
@return [Hash] The parsed JSON data for the object from the API | [
"Given",
"initialization",
"args",
"perform",
"an",
"API",
"lookup",
"for",
"an",
"object",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object.rb#L947-L973 |
15,928 | PixarAnimationStudios/ruby-jss | lib/jss/api_object.rb | JSS.APIObject.rest_xml | def rest_xml
doc = REXML::Document.new JSS::APIConnection::XML_HEADER
tmpl = doc.add_element self.class::RSRC_OBJECT_KEY.to_s
tmpl.add_element('name').text = @name
doc.to_s
end | ruby | def rest_xml
doc = REXML::Document.new JSS::APIConnection::XML_HEADER
tmpl = doc.add_element self.class::RSRC_OBJECT_KEY.to_s
tmpl.add_element('name').text = @name
doc.to_s
end | [
"def",
"rest_xml",
"doc",
"=",
"REXML",
"::",
"Document",
".",
"new",
"JSS",
"::",
"APIConnection",
"::",
"XML_HEADER",
"tmpl",
"=",
"doc",
".",
"add_element",
"self",
".",
"class",
"::",
"RSRC_OBJECT_KEY",
".",
"to_s",
"tmpl",
".",
"add_element",
"(",
"'n... | Return a String with the XML Resource
for submitting creation or changes to the JSS via
the API via the Creatable or Updatable modules
Most classes will redefine this method. | [
"Return",
"a",
"String",
"with",
"the",
"XML",
"Resource",
"for",
"submitting",
"creation",
"or",
"changes",
"to",
"the",
"JSS",
"via",
"the",
"API",
"via",
"the",
"Creatable",
"or",
"Updatable",
"modules"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object.rb#L1160-L1165 |
15,929 | PixarAnimationStudios/ruby-jss | lib/jss/configuration.rb | JSS.Configuration.reload | def reload(file = nil)
clear_all
if file
read file
return true
end
read_global
read_user
return true
end | ruby | def reload(file = nil)
clear_all
if file
read file
return true
end
read_global
read_user
return true
end | [
"def",
"reload",
"(",
"file",
"=",
"nil",
")",
"clear_all",
"if",
"file",
"read",
"file",
"return",
"true",
"end",
"read_global",
"read_user",
"return",
"true",
"end"
] | Clear the settings and reload the prefs files, or another file if provided
@param file[String,Pathname] a non-standard prefs file to load
@return [void] | [
"Clear",
"the",
"settings",
"and",
"reload",
"the",
"prefs",
"files",
"or",
"another",
"file",
"if",
"provided"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/configuration.rb#L212-L221 |
15,930 | PixarAnimationStudios/ruby-jss | lib/jss/configuration.rb | JSS.Configuration.read | def read(file)
Pathname.new(file).read.each_line do |line|
# skip blank lines and those starting with #
next if line =~ /^\s*(#|$)/
line.strip =~ /^(\w+?):\s*(\S.*)$/
next unless $1
attr = $1.to_sym
setter = "#{attr}=".to_sym
value = $2.strip... | ruby | def read(file)
Pathname.new(file).read.each_line do |line|
# skip blank lines and those starting with #
next if line =~ /^\s*(#|$)/
line.strip =~ /^(\w+?):\s*(\S.*)$/
next unless $1
attr = $1.to_sym
setter = "#{attr}=".to_sym
value = $2.strip... | [
"def",
"read",
"(",
"file",
")",
"Pathname",
".",
"new",
"(",
"file",
")",
".",
"read",
".",
"each_line",
"do",
"|",
"line",
"|",
"# skip blank lines and those starting with #",
"next",
"if",
"line",
"=~",
"/",
"\\s",
"/",
"line",
".",
"strip",
"=~",
"/"... | Read in any prefs file
@param file[String,Pathname] the file to read
@return [void] | [
"Read",
"in",
"any",
"prefs",
"file"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/configuration.rb#L291-L312 |
15,931 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/vppable.rb | JSS.VPPable.assign_vpp_device_based_licenses= | def assign_vpp_device_based_licenses=(new_val)
return nil if new_val == @assign_vpp_device_based_licenses
raise JSS::InvalidDataError, 'New value must be true or false' unless new_val.jss_boolean?
@assign_vpp_device_based_licenses = new_val
@need_to_update = true
end | ruby | def assign_vpp_device_based_licenses=(new_val)
return nil if new_val == @assign_vpp_device_based_licenses
raise JSS::InvalidDataError, 'New value must be true or false' unless new_val.jss_boolean?
@assign_vpp_device_based_licenses = new_val
@need_to_update = true
end | [
"def",
"assign_vpp_device_based_licenses",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"new_val",
"==",
"@assign_vpp_device_based_licenses",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'New value must be true or false'",
"unless",
"new_val",
".",
"jss_boolean?",
... | Set whether or not the VPP licenses should be assigned
by device rather than by user
@param new_val[Boolean] The new value
@return [void] | [
"Set",
"whether",
"or",
"not",
"the",
"VPP",
"licenses",
"should",
"be",
"assigned",
"by",
"device",
"rather",
"than",
"by",
"user"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/vppable.rb#L77-L82 |
15,932 | PixarAnimationStudios/ruby-jss | lib/jss/api_object/vppable.rb | JSS.VPPable.add_vpp_xml | def add_vpp_xml(xdoc)
doc_root = xdoc.root
vpp = doc_root.add_element 'vpp'
vpp.add_element('assign_vpp_device_based_licenses').text = @assign_vpp_device_based_licenses
end | ruby | def add_vpp_xml(xdoc)
doc_root = xdoc.root
vpp = doc_root.add_element 'vpp'
vpp.add_element('assign_vpp_device_based_licenses').text = @assign_vpp_device_based_licenses
end | [
"def",
"add_vpp_xml",
"(",
"xdoc",
")",
"doc_root",
"=",
"xdoc",
".",
"root",
"vpp",
"=",
"doc_root",
".",
"add_element",
"'vpp'",
"vpp",
".",
"add_element",
"(",
"'assign_vpp_device_based_licenses'",
")",
".",
"text",
"=",
"@assign_vpp_device_based_licenses",
"en... | Insert an appropriate vpp element into the XML for sending changes
to the JSS
@param xdoc[REXML::Document] The XML document to work with
@return [void] | [
"Insert",
"an",
"appropriate",
"vpp",
"element",
"into",
"the",
"XML",
"for",
"sending",
"changes",
"to",
"the",
"JSS"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/vppable.rb#L109-L113 |
15,933 | elct9620/rails-letsencrypt | app/models/concerns/lets_encrypt/certificate_verifiable.rb | LetsEncrypt.CertificateVerifiable.verify | def verify
create_order
start_challenge
wait_verify_status
check_verify_status
rescue Acme::Client::Error => e
retry_on_verify_error(e)
end | ruby | def verify
create_order
start_challenge
wait_verify_status
check_verify_status
rescue Acme::Client::Error => e
retry_on_verify_error(e)
end | [
"def",
"verify",
"create_order",
"start_challenge",
"wait_verify_status",
"check_verify_status",
"rescue",
"Acme",
"::",
"Client",
"::",
"Error",
"=>",
"e",
"retry_on_verify_error",
"(",
"e",
")",
"end"
] | Returns true if verify domain is succeed. | [
"Returns",
"true",
"if",
"verify",
"domain",
"is",
"succeed",
"."
] | 25aa4685320bca4f871fa7e573e10693bc2a2dc3 | https://github.com/elct9620/rails-letsencrypt/blob/25aa4685320bca4f871fa7e573e10693bc2a2dc3/app/models/concerns/lets_encrypt/certificate_verifiable.rb#L9-L16 |
15,934 | weppos/whois-parser | lib/whois/safe_record.rb | Whois.SafeRecord.properties | def properties
hash = {}
Parser::PROPERTIES.each do |property|
hash[property] = __send__(property)
end
hash
end | ruby | def properties
hash = {}
Parser::PROPERTIES.each do |property|
hash[property] = __send__(property)
end
hash
end | [
"def",
"properties",
"hash",
"=",
"{",
"}",
"Parser",
"::",
"PROPERTIES",
".",
"each",
"do",
"|",
"property",
"|",
"hash",
"[",
"property",
"]",
"=",
"__send__",
"(",
"property",
")",
"end",
"hash",
"end"
] | Returns a Hash containing all supported properties for this record
along with corresponding values.
@return [{ Symbol => Object }] | [
"Returns",
"a",
"Hash",
"containing",
"all",
"supported",
"properties",
"for",
"this",
"record",
"along",
"with",
"corresponding",
"values",
"."
] | 9db810d187a97175c3b28edd100c4edd07d683f2 | https://github.com/weppos/whois-parser/blob/9db810d187a97175c3b28edd100c4edd07d683f2/lib/whois/safe_record.rb#L83-L89 |
15,935 | change/method_profiler | lib/method_profiler/report.rb | MethodProfiler.Report.to_a | def to_a
if @order == :ascending
@data.sort { |a, b| a[@sort_by] <=> b[@sort_by] }
else
@data.sort { |a, b| b[@sort_by] <=> a[@sort_by] }
end
end | ruby | def to_a
if @order == :ascending
@data.sort { |a, b| a[@sort_by] <=> b[@sort_by] }
else
@data.sort { |a, b| b[@sort_by] <=> a[@sort_by] }
end
end | [
"def",
"to_a",
"if",
"@order",
"==",
":ascending",
"@data",
".",
"sort",
"{",
"|",
"a",
",",
"b",
"|",
"a",
"[",
"@sort_by",
"]",
"<=>",
"b",
"[",
"@sort_by",
"]",
"}",
"else",
"@data",
".",
"sort",
"{",
"|",
"a",
",",
"b",
"|",
"b",
"[",
"@s... | Sorts the data by the currently set criteria and returns an array of profiling results.
@return [Array] An array of profiling results. | [
"Sorts",
"the",
"data",
"by",
"the",
"currently",
"set",
"criteria",
"and",
"returns",
"an",
"array",
"of",
"profiling",
"results",
"."
] | f2ddb631675211b5d52136e0c3f50ca42728c713 | https://github.com/change/method_profiler/blob/f2ddb631675211b5d52136e0c3f50ca42728c713/lib/method_profiler/report.rb#L66-L72 |
15,936 | change/method_profiler | lib/method_profiler/report.rb | MethodProfiler.Report.to_s | def to_s
[
"MethodProfiler results for: #{@name}",
Hirb::Helpers::Table.render(
to_a,
headers: HEADERS.dup,
fields: FIELDS.dup,
filters: {
min: :to_milliseconds,
max: :to_milliseconds,
average: :to_milliseconds,
... | ruby | def to_s
[
"MethodProfiler results for: #{@name}",
Hirb::Helpers::Table.render(
to_a,
headers: HEADERS.dup,
fields: FIELDS.dup,
filters: {
min: :to_milliseconds,
max: :to_milliseconds,
average: :to_milliseconds,
... | [
"def",
"to_s",
"[",
"\"MethodProfiler results for: #{@name}\"",
",",
"Hirb",
"::",
"Helpers",
"::",
"Table",
".",
"render",
"(",
"to_a",
",",
"headers",
":",
"HEADERS",
".",
"dup",
",",
"fields",
":",
"FIELDS",
".",
"dup",
",",
"filters",
":",
"{",
"min",
... | Sorts the data by the currently set criteria and returns a pretty printed table as a string.
@return [String] A table of profiling results. | [
"Sorts",
"the",
"data",
"by",
"the",
"currently",
"set",
"criteria",
"and",
"returns",
"a",
"pretty",
"printed",
"table",
"as",
"a",
"string",
"."
] | f2ddb631675211b5d52136e0c3f50ca42728c713 | https://github.com/change/method_profiler/blob/f2ddb631675211b5d52136e0c3f50ca42728c713/lib/method_profiler/report.rb#L78-L94 |
15,937 | david942j/seccomp-tools | lib/seccomp-tools/asm/asm.rb | SeccompTools.Asm.asm | def asm(str, arch: nil)
arch = Util.system_arch if arch.nil? # TODO: show warning
compiler = Compiler.new(arch)
str.lines.each { |l| compiler.process(l) }
compiler.compile!.map(&:asm).join
end | ruby | def asm(str, arch: nil)
arch = Util.system_arch if arch.nil? # TODO: show warning
compiler = Compiler.new(arch)
str.lines.each { |l| compiler.process(l) }
compiler.compile!.map(&:asm).join
end | [
"def",
"asm",
"(",
"str",
",",
"arch",
":",
"nil",
")",
"arch",
"=",
"Util",
".",
"system_arch",
"if",
"arch",
".",
"nil?",
"# TODO: show warning",
"compiler",
"=",
"Compiler",
".",
"new",
"(",
"arch",
")",
"str",
".",
"lines",
".",
"each",
"{",
"|",... | Assembler of seccomp bpf.
@param [String] str
@return [String]
Raw bpf bytes.
@example
asm(<<EOS)
# lines start with '#' are comments
A = sys_number # here's a comment, too
A >= 0x40000000 ? dead : next # 'next' is a keyword, denote the next instruction
A == read ? ok : next ... | [
"Assembler",
"of",
"seccomp",
"bpf",
"."
] | 8dfc288a28eab2d683d1a4cc0fed405d75dc5595 | https://github.com/david942j/seccomp-tools/blob/8dfc288a28eab2d683d1a4cc0fed405d75dc5595/lib/seccomp-tools/asm/asm.rb#L27-L32 |
15,938 | david942j/seccomp-tools | lib/seccomp-tools/cli/cli.rb | SeccompTools.CLI.work | def work(argv)
# all -h equivalent to --help
argv = argv.map { |a| a == '-h' ? '--help' : a }
idx = argv.index { |c| !c.start_with?('-') }
preoption = idx.nil? ? argv.shift(argv.size) : argv.shift(idx)
# handle --version or --help or nothing
return show("SeccompTools Version #{Secco... | ruby | def work(argv)
# all -h equivalent to --help
argv = argv.map { |a| a == '-h' ? '--help' : a }
idx = argv.index { |c| !c.start_with?('-') }
preoption = idx.nil? ? argv.shift(argv.size) : argv.shift(idx)
# handle --version or --help or nothing
return show("SeccompTools Version #{Secco... | [
"def",
"work",
"(",
"argv",
")",
"# all -h equivalent to --help",
"argv",
"=",
"argv",
".",
"map",
"{",
"|",
"a",
"|",
"a",
"==",
"'-h'",
"?",
"'--help'",
":",
"a",
"}",
"idx",
"=",
"argv",
".",
"index",
"{",
"|",
"c",
"|",
"!",
"c",
".",
"start_... | Main working method of CLI.
@param [Array<String>] argv
Command line arguments.
@return [void]
@example
work(%w[--help])
#=> # usage message
work(%w[--version])
#=> # version message | [
"Main",
"working",
"method",
"of",
"CLI",
"."
] | 8dfc288a28eab2d683d1a4cc0fed405d75dc5595 | https://github.com/david942j/seccomp-tools/blob/8dfc288a28eab2d683d1a4cc0fed405d75dc5595/lib/seccomp-tools/cli/cli.rb#L40-L56 |
15,939 | david942j/seccomp-tools | lib/seccomp-tools/disasm/disasm.rb | SeccompTools.Disasm.disasm | def disasm(raw, arch: nil)
codes = to_bpf(raw, arch)
contexts = Array.new(codes.size) { Set.new }
contexts[0].add(Context.new)
# all we care is if A is exactly one of data[*]
dis = codes.zip(contexts).map do |code, ctxs|
ctxs.each do |ctx|
code.branch(ctx) do |pc, c|
... | ruby | def disasm(raw, arch: nil)
codes = to_bpf(raw, arch)
contexts = Array.new(codes.size) { Set.new }
contexts[0].add(Context.new)
# all we care is if A is exactly one of data[*]
dis = codes.zip(contexts).map do |code, ctxs|
ctxs.each do |ctx|
code.branch(ctx) do |pc, c|
... | [
"def",
"disasm",
"(",
"raw",
",",
"arch",
":",
"nil",
")",
"codes",
"=",
"to_bpf",
"(",
"raw",
",",
"arch",
")",
"contexts",
"=",
"Array",
".",
"new",
"(",
"codes",
".",
"size",
")",
"{",
"Set",
".",
"new",
"}",
"contexts",
"[",
"0",
"]",
".",
... | Disassemble bpf codes.
@param [String] raw
The raw bpf bytes.
@param [Symbol] arch
Architecture. | [
"Disassemble",
"bpf",
"codes",
"."
] | 8dfc288a28eab2d683d1a4cc0fed405d75dc5595 | https://github.com/david942j/seccomp-tools/blob/8dfc288a28eab2d683d1a4cc0fed405d75dc5595/lib/seccomp-tools/disasm/disasm.rb#L17-L35 |
15,940 | david942j/seccomp-tools | lib/seccomp-tools/bpf.rb | SeccompTools.BPF.inst | def inst
@inst ||= case command
when :alu then SeccompTools::Instruction::ALU
when :jmp then SeccompTools::Instruction::JMP
when :ld then SeccompTools::Instruction::LD
when :ldx then SeccompTools::Instruction::LDX
when :misc then... | ruby | def inst
@inst ||= case command
when :alu then SeccompTools::Instruction::ALU
when :jmp then SeccompTools::Instruction::JMP
when :ld then SeccompTools::Instruction::LD
when :ldx then SeccompTools::Instruction::LDX
when :misc then... | [
"def",
"inst",
"@inst",
"||=",
"case",
"command",
"when",
":alu",
"then",
"SeccompTools",
"::",
"Instruction",
"::",
"ALU",
"when",
":jmp",
"then",
"SeccompTools",
"::",
"Instruction",
"::",
"JMP",
"when",
":ld",
"then",
"SeccompTools",
"::",
"Instruction",
":... | Corresponding instruction object.
@return [SeccompTools::Instruction::Base] | [
"Corresponding",
"instruction",
"object",
"."
] | 8dfc288a28eab2d683d1a4cc0fed405d75dc5595 | https://github.com/david942j/seccomp-tools/blob/8dfc288a28eab2d683d1a4cc0fed405d75dc5595/lib/seccomp-tools/bpf.rb#L91-L102 |
15,941 | david942j/seccomp-tools | lib/seccomp-tools/util.rb | SeccompTools.Util.supported_archs | def supported_archs
@supported_archs ||= Dir.glob(File.join(__dir__, 'consts', '*.rb'))
.map { |f| File.basename(f, '.rb').to_sym }
.sort
end | ruby | def supported_archs
@supported_archs ||= Dir.glob(File.join(__dir__, 'consts', '*.rb'))
.map { |f| File.basename(f, '.rb').to_sym }
.sort
end | [
"def",
"supported_archs",
"@supported_archs",
"||=",
"Dir",
".",
"glob",
"(",
"File",
".",
"join",
"(",
"__dir__",
",",
"'consts'",
",",
"'*.rb'",
")",
")",
".",
"map",
"{",
"|",
"f",
"|",
"File",
".",
"basename",
"(",
"f",
",",
"'.rb'",
")",
".",
... | Get currently supported architectures.
@return [Array<Symbol>]
Architectures. | [
"Get",
"currently",
"supported",
"architectures",
"."
] | 8dfc288a28eab2d683d1a4cc0fed405d75dc5595 | https://github.com/david942j/seccomp-tools/blob/8dfc288a28eab2d683d1a4cc0fed405d75dc5595/lib/seccomp-tools/util.rb#L9-L13 |
15,942 | david942j/seccomp-tools | lib/seccomp-tools/util.rb | SeccompTools.Util.colorize | def colorize(s, t: nil)
s = s.to_s
return s unless colorize_enabled?
cc = COLOR_CODE
color = cc[t]
"#{color}#{s.sub(cc[:esc_m], cc[:esc_m] + color)}#{cc[:esc_m]}"
end | ruby | def colorize(s, t: nil)
s = s.to_s
return s unless colorize_enabled?
cc = COLOR_CODE
color = cc[t]
"#{color}#{s.sub(cc[:esc_m], cc[:esc_m] + color)}#{cc[:esc_m]}"
end | [
"def",
"colorize",
"(",
"s",
",",
"t",
":",
"nil",
")",
"s",
"=",
"s",
".",
"to_s",
"return",
"s",
"unless",
"colorize_enabled?",
"cc",
"=",
"COLOR_CODE",
"color",
"=",
"cc",
"[",
"t",
"]",
"\"#{color}#{s.sub(cc[:esc_m], cc[:esc_m] + color)}#{cc[:esc_m]}\"",
"... | Wrapper color codes.
@param [String] s
Contents to wrapper.
@param [Symbol?] t
Specific which kind of color to use, valid symbols are defined in {Util.COLOR_CODE}.
@return [String]
Wrapper with color codes. | [
"Wrapper",
"color",
"codes",
"."
] | 8dfc288a28eab2d683d1a4cc0fed405d75dc5595 | https://github.com/david942j/seccomp-tools/blob/8dfc288a28eab2d683d1a4cc0fed405d75dc5595/lib/seccomp-tools/util.rb#L57-L64 |
15,943 | appium/ruby_lib_core | script/commands.rb | Script.CommandsChecker.get_mjsonwp_routes | def get_mjsonwp_routes(to_path = './mjsonwp_routes.js')
uri = URI 'https://raw.githubusercontent.com/appium/appium-base-driver/master/lib/protocol/routes.js?raw=1'
result = Net::HTTP.get uri
File.delete to_path if File.exist? to_path
File.write to_path, result
to_path
end | ruby | def get_mjsonwp_routes(to_path = './mjsonwp_routes.js')
uri = URI 'https://raw.githubusercontent.com/appium/appium-base-driver/master/lib/protocol/routes.js?raw=1'
result = Net::HTTP.get uri
File.delete to_path if File.exist? to_path
File.write to_path, result
to_path
end | [
"def",
"get_mjsonwp_routes",
"(",
"to_path",
"=",
"'./mjsonwp_routes.js'",
")",
"uri",
"=",
"URI",
"'https://raw.githubusercontent.com/appium/appium-base-driver/master/lib/protocol/routes.js?raw=1'",
"result",
"=",
"Net",
"::",
"HTTP",
".",
"get",
"uri",
"File",
".",
"delet... | Set commands implemented in this core library.
- implemented_mjsonwp_commands: All commands include ::Selenium::WebDriver::Remote::OSS::Bridge::COMMANDS
- implemented_w3c_commands: All commands include ::Selenium::WebDriver::Remote::W3C::Bridge::COMMANDS
- implemented_core_commands: All commands except for selen... | [
"Set",
"commands",
"implemented",
"in",
"this",
"core",
"library",
"."
] | 2d8a8f3433f6774a1cc2d76028269ca006ca5273 | https://github.com/appium/ruby_lib_core/blob/2d8a8f3433f6774a1cc2d76028269ca006ca5273/script/commands.rb#L49-L56 |
15,944 | appium/ruby_lib_core | script/commands.rb | Script.CommandsChecker.diff_except_for_webdriver | def diff_except_for_webdriver
result = compare_commands(@spec_commands, @implemented_core_commands)
white_list.each { |v| result.delete v }
result
end | ruby | def diff_except_for_webdriver
result = compare_commands(@spec_commands, @implemented_core_commands)
white_list.each { |v| result.delete v }
result
end | [
"def",
"diff_except_for_webdriver",
"result",
"=",
"compare_commands",
"(",
"@spec_commands",
",",
"@implemented_core_commands",
")",
"white_list",
".",
"each",
"{",
"|",
"v",
"|",
"result",
".",
"delete",
"v",
"}",
"result",
"end"
] | Commands, only this core library, which haven't been implemented in ruby core library yet.
@return [Hash] | [
"Commands",
"only",
"this",
"core",
"library",
"which",
"haven",
"t",
"been",
"implemented",
"in",
"ruby",
"core",
"library",
"yet",
"."
] | 2d8a8f3433f6774a1cc2d76028269ca006ca5273 | https://github.com/appium/ruby_lib_core/blob/2d8a8f3433f6774a1cc2d76028269ca006ca5273/script/commands.rb#L108-L112 |
15,945 | basecamp/name_of_person | lib/name_of_person/assignable_name.rb | NameOfPerson.AssignableName.name= | def name=(name)
full_name = NameOfPerson::PersonName.full(name)
self.first_name, self.last_name = full_name&.first, full_name&.last
end | ruby | def name=(name)
full_name = NameOfPerson::PersonName.full(name)
self.first_name, self.last_name = full_name&.first, full_name&.last
end | [
"def",
"name",
"=",
"(",
"name",
")",
"full_name",
"=",
"NameOfPerson",
"::",
"PersonName",
".",
"full",
"(",
"name",
")",
"self",
".",
"first_name",
",",
"self",
".",
"last_name",
"=",
"full_name",
"&.",
"first",
",",
"full_name",
"&.",
"last",
"end"
] | Assigns first_name and last_name attributes as extracted from a supplied full name. | [
"Assigns",
"first_name",
"and",
"last_name",
"attributes",
"as",
"extracted",
"from",
"a",
"supplied",
"full",
"name",
"."
] | 16978debe3d6391739bfef7da5b4df487f44ccda | https://github.com/basecamp/name_of_person/blob/16978debe3d6391739bfef7da5b4df487f44ccda/lib/name_of_person/assignable_name.rb#L6-L9 |
15,946 | salesking/sepa_king | lib/sepa_king/message.rb | SEPA.Message.message_identification= | def message_identification=(value)
raise ArgumentError.new('message_identification must be a string!') unless value.is_a?(String)
regex = /\A([A-Za-z0-9]|[\+|\?|\/|\-|\:|\(|\)|\.|\,|\'|\ ]){1,35}\z/
raise ArgumentError.new("message_identification does not match #{regex}!") unless value.match(regex)
... | ruby | def message_identification=(value)
raise ArgumentError.new('message_identification must be a string!') unless value.is_a?(String)
regex = /\A([A-Za-z0-9]|[\+|\?|\/|\-|\:|\(|\)|\.|\,|\'|\ ]){1,35}\z/
raise ArgumentError.new("message_identification does not match #{regex}!") unless value.match(regex)
... | [
"def",
"message_identification",
"=",
"(",
"value",
")",
"raise",
"ArgumentError",
".",
"new",
"(",
"'message_identification must be a string!'",
")",
"unless",
"value",
".",
"is_a?",
"(",
"String",
")",
"regex",
"=",
"/",
"\\A",
"\\+",
"\\?",
"\\/",
"\\-",
"\... | Set unique identifer for the message | [
"Set",
"unique",
"identifer",
"for",
"the",
"message"
] | bfe6a633c3a4b6077ece313414d790eca5375681 | https://github.com/salesking/sepa_king/blob/bfe6a633c3a4b6077ece313414d790eca5375681/lib/sepa_king/message.rb#L73-L80 |
15,947 | salesking/sepa_king | lib/sepa_king/message.rb | SEPA.Message.batch_id | def batch_id(transaction_reference)
grouped_transactions.each do |group, transactions|
if transactions.select { |transaction| transaction.reference == transaction_reference }.any?
return payment_information_identification(group)
end
end
end | ruby | def batch_id(transaction_reference)
grouped_transactions.each do |group, transactions|
if transactions.select { |transaction| transaction.reference == transaction_reference }.any?
return payment_information_identification(group)
end
end
end | [
"def",
"batch_id",
"(",
"transaction_reference",
")",
"grouped_transactions",
".",
"each",
"do",
"|",
"group",
",",
"transactions",
"|",
"if",
"transactions",
".",
"select",
"{",
"|",
"transaction",
"|",
"transaction",
".",
"reference",
"==",
"transaction_referenc... | Returns the id of the batch to which the given transaction belongs
Identified based upon the reference of the transaction | [
"Returns",
"the",
"id",
"of",
"the",
"batch",
"to",
"which",
"the",
"given",
"transaction",
"belongs",
"Identified",
"based",
"upon",
"the",
"reference",
"of",
"the",
"transaction"
] | bfe6a633c3a4b6077ece313414d790eca5375681 | https://github.com/salesking/sepa_king/blob/bfe6a633c3a4b6077ece313414d790eca5375681/lib/sepa_king/message.rb#L105-L111 |
15,948 | tweetstream/tweetstream | lib/tweetstream/client.rb | TweetStream.Client.follow | def follow(*user_ids, &block)
query = TweetStream::Arguments.new(user_ids)
filter(query.options.merge(:follow => query), &block)
end | ruby | def follow(*user_ids, &block)
query = TweetStream::Arguments.new(user_ids)
filter(query.options.merge(:follow => query), &block)
end | [
"def",
"follow",
"(",
"*",
"user_ids",
",",
"&",
"block",
")",
"query",
"=",
"TweetStream",
"::",
"Arguments",
".",
"new",
"(",
"user_ids",
")",
"filter",
"(",
"query",
".",
"options",
".",
"merge",
"(",
":follow",
"=>",
"query",
")",
",",
"block",
"... | Returns public statuses from or in reply to a set of users. Mentions
("Hello @user!") and implicit replies ("@user Hello!" created without
pressing the reply "swoosh") are not matched. Requires integer user
IDs, not screen names. Query parameters may be passed as the last argument. | [
"Returns",
"public",
"statuses",
"from",
"or",
"in",
"reply",
"to",
"a",
"set",
"of",
"users",
".",
"Mentions",
"(",
"Hello"
] | 27c5f411627dc30ce1268923fc9b408652f98050 | https://github.com/tweetstream/tweetstream/blob/27c5f411627dc30ce1268923fc9b408652f98050/lib/tweetstream/client.rb#L113-L116 |
15,949 | tweetstream/tweetstream | lib/tweetstream/client.rb | TweetStream.Client.userstream | def userstream(query_params = {}, &block)
stream_params = {:host => 'userstream.twitter.com'}
query_params.merge!(:extra_stream_parameters => stream_params)
start('/1.1/user.json', query_params, &block)
end | ruby | def userstream(query_params = {}, &block)
stream_params = {:host => 'userstream.twitter.com'}
query_params.merge!(:extra_stream_parameters => stream_params)
start('/1.1/user.json', query_params, &block)
end | [
"def",
"userstream",
"(",
"query_params",
"=",
"{",
"}",
",",
"&",
"block",
")",
"stream_params",
"=",
"{",
":host",
"=>",
"'userstream.twitter.com'",
"}",
"query_params",
".",
"merge!",
"(",
":extra_stream_parameters",
"=>",
"stream_params",
")",
"start",
"(",
... | Make a call to the userstream api for currently authenticated user | [
"Make",
"a",
"call",
"to",
"the",
"userstream",
"api",
"for",
"currently",
"authenticated",
"user"
] | 27c5f411627dc30ce1268923fc9b408652f98050 | https://github.com/tweetstream/tweetstream/blob/27c5f411627dc30ce1268923fc9b408652f98050/lib/tweetstream/client.rb#L141-L145 |
15,950 | tweetstream/tweetstream | lib/tweetstream/client.rb | TweetStream.Client.start | def start(path, query_parameters = {}, &block)
if EventMachine.reactor_running?
connect(path, query_parameters, &block)
else
if EventMachine.epoll?
EventMachine.epoll
elsif EventMachine.kqueue?
EventMachine.kqueue
else
Kernel.warn('Your OS does n... | ruby | def start(path, query_parameters = {}, &block)
if EventMachine.reactor_running?
connect(path, query_parameters, &block)
else
if EventMachine.epoll?
EventMachine.epoll
elsif EventMachine.kqueue?
EventMachine.kqueue
else
Kernel.warn('Your OS does n... | [
"def",
"start",
"(",
"path",
",",
"query_parameters",
"=",
"{",
"}",
",",
"&",
"block",
")",
"if",
"EventMachine",
".",
"reactor_running?",
"connect",
"(",
"path",
",",
"query_parameters",
",",
"block",
")",
"else",
"if",
"EventMachine",
".",
"epoll?",
"Ev... | connect to twitter while starting a new EventMachine run loop | [
"connect",
"to",
"twitter",
"while",
"starting",
"a",
"new",
"EventMachine",
"run",
"loop"
] | 27c5f411627dc30ce1268923fc9b408652f98050 | https://github.com/tweetstream/tweetstream/blob/27c5f411627dc30ce1268923fc9b408652f98050/lib/tweetstream/client.rb#L413-L429 |
15,951 | tweetstream/tweetstream | lib/tweetstream/client.rb | TweetStream.Client.connect | def connect(path, options = {}, &block)
stream_parameters, callbacks = connection_options(path, options)
@stream = EM::Twitter::Client.connect(stream_parameters)
@stream.each do |item|
begin
hash = MultiJson.decode(item, :symbolize_keys => true)
rescue MultiJson::DecodeError... | ruby | def connect(path, options = {}, &block)
stream_parameters, callbacks = connection_options(path, options)
@stream = EM::Twitter::Client.connect(stream_parameters)
@stream.each do |item|
begin
hash = MultiJson.decode(item, :symbolize_keys => true)
rescue MultiJson::DecodeError... | [
"def",
"connect",
"(",
"path",
",",
"options",
"=",
"{",
"}",
",",
"&",
"block",
")",
"stream_parameters",
",",
"callbacks",
"=",
"connection_options",
"(",
"path",
",",
"options",
")",
"@stream",
"=",
"EM",
"::",
"Twitter",
"::",
"Client",
".",
"connect... | connect to twitter without starting a new EventMachine run loop | [
"connect",
"to",
"twitter",
"without",
"starting",
"a",
"new",
"EventMachine",
"run",
"loop"
] | 27c5f411627dc30ce1268923fc9b408652f98050 | https://github.com/tweetstream/tweetstream/blob/27c5f411627dc30ce1268923fc9b408652f98050/lib/tweetstream/client.rb#L432-L475 |
15,952 | voxpupuli/puppet-syntax | lib/puppet-syntax/hiera.rb | PuppetSyntax.Hiera.check_eyaml_data | def check_eyaml_data(name, val)
error = nil
if val.is_a? String
err = check_eyaml_blob(val)
error = "Key #{name} #{err}" if err
elsif val.is_a? Array
val.each_with_index do |v, idx|
error = check_eyaml_data("#{name}[#{idx}]", v)
break if error
end
... | ruby | def check_eyaml_data(name, val)
error = nil
if val.is_a? String
err = check_eyaml_blob(val)
error = "Key #{name} #{err}" if err
elsif val.is_a? Array
val.each_with_index do |v, idx|
error = check_eyaml_data("#{name}[#{idx}]", v)
break if error
end
... | [
"def",
"check_eyaml_data",
"(",
"name",
",",
"val",
")",
"error",
"=",
"nil",
"if",
"val",
".",
"is_a?",
"String",
"err",
"=",
"check_eyaml_blob",
"(",
"val",
")",
"error",
"=",
"\"Key #{name} #{err}\"",
"if",
"err",
"elsif",
"val",
".",
"is_a?",
"Array",
... | Recurse through complex data structures. Return on first error. | [
"Recurse",
"through",
"complex",
"data",
"structures",
".",
"Return",
"on",
"first",
"error",
"."
] | eb1592218739119a2f9307b3e33b7e1f1df59a7c | https://github.com/voxpupuli/puppet-syntax/blob/eb1592218739119a2f9307b3e33b7e1f1df59a7c/lib/puppet-syntax/hiera.rb#L25-L42 |
15,953 | orta/danger-junit | lib/junit/plugin.rb | Danger.DangerJunit.parse_files | def parse_files(*files)
require 'ox'
@tests = []
failed_tests = []
Array(files).flatten.each do |file|
raise "No JUnit file was found at #{file}" unless File.exist? file
xml_string = File.read(file)
doc = Ox.parse(xml_string)
suite_root = doc.nodes.first.value ... | ruby | def parse_files(*files)
require 'ox'
@tests = []
failed_tests = []
Array(files).flatten.each do |file|
raise "No JUnit file was found at #{file}" unless File.exist? file
xml_string = File.read(file)
doc = Ox.parse(xml_string)
suite_root = doc.nodes.first.value ... | [
"def",
"parse_files",
"(",
"*",
"files",
")",
"require",
"'ox'",
"@tests",
"=",
"[",
"]",
"failed_tests",
"=",
"[",
"]",
"Array",
"(",
"files",
")",
".",
"flatten",
".",
"each",
"do",
"|",
"file",
"|",
"raise",
"\"No JUnit file was found at #{file}\"",
"un... | Parses multiple XML files, which fills all the attributes,
will `raise` for errors
@return [void] | [
"Parses",
"multiple",
"XML",
"files",
"which",
"fills",
"all",
"the",
"attributes",
"will",
"raise",
"for",
"errors"
] | 32fc5d2c026604a0880a3901783628dab06e4877 | https://github.com/orta/danger-junit/blob/32fc5d2c026604a0880a3901783628dab06e4877/lib/junit/plugin.rb#L105-L145 |
15,954 | orta/danger-junit | lib/junit/plugin.rb | Danger.DangerJunit.report | def report
return if failures.nil? # because danger calls `report` before loading a file
warn("Skipped #{skipped.count} tests.") if show_skipped_tests && skipped.count > 0
unless failures.empty? && errors.empty?
fail('Tests have failed, see below for more information.', sticky: false)
... | ruby | def report
return if failures.nil? # because danger calls `report` before loading a file
warn("Skipped #{skipped.count} tests.") if show_skipped_tests && skipped.count > 0
unless failures.empty? && errors.empty?
fail('Tests have failed, see below for more information.', sticky: false)
... | [
"def",
"report",
"return",
"if",
"failures",
".",
"nil?",
"# because danger calls `report` before loading a file",
"warn",
"(",
"\"Skipped #{skipped.count} tests.\"",
")",
"if",
"show_skipped_tests",
"&&",
"skipped",
".",
"count",
">",
"0",
"unless",
"failures",
".",
"e... | Causes a build fail if there are test failures,
and outputs a markdown table of the results.
@return [void] | [
"Causes",
"a",
"build",
"fail",
"if",
"there",
"are",
"test",
"failures",
"and",
"outputs",
"a",
"markdown",
"table",
"of",
"the",
"results",
"."
] | 32fc5d2c026604a0880a3901783628dab06e4877 | https://github.com/orta/danger-junit/blob/32fc5d2c026604a0880a3901783628dab06e4877/lib/junit/plugin.rb#L151-L184 |
15,955 | oleander/git-fame-rb | lib/git_fame/base.rb | GitFame.Base.to_csv | def to_csv
CSV.generate do |csv|
csv << fields
authors.each do |author|
csv << fields.map do |f|
author.send(f)
end
end
end
end | ruby | def to_csv
CSV.generate do |csv|
csv << fields
authors.each do |author|
csv << fields.map do |f|
author.send(f)
end
end
end
end | [
"def",
"to_csv",
"CSV",
".",
"generate",
"do",
"|",
"csv",
"|",
"csv",
"<<",
"fields",
"authors",
".",
"each",
"do",
"|",
"author",
"|",
"csv",
"<<",
"fields",
".",
"map",
"do",
"|",
"f",
"|",
"author",
".",
"send",
"(",
"f",
")",
"end",
"end",
... | Generate csv output | [
"Generate",
"csv",
"output"
] | d0f17660bc26d18e27fd86952a84c4a6164689ec | https://github.com/oleander/git-fame-rb/blob/d0f17660bc26d18e27fd86952a84c4a6164689ec/lib/git_fame/base.rb#L121-L130 |
15,956 | oleander/git-fame-rb | lib/git_fame/base.rb | GitFame.Base.printable_fields | def printable_fields
raw_fields.map do |field|
field.is_a?(Array) ? field.last : field
end
end | ruby | def printable_fields
raw_fields.map do |field|
field.is_a?(Array) ? field.last : field
end
end | [
"def",
"printable_fields",
"raw_fields",
".",
"map",
"do",
"|",
"field",
"|",
"field",
".",
"is_a?",
"(",
"Array",
")",
"?",
"field",
".",
"last",
":",
"field",
"end",
"end"
] | Uses the more printable names in @visible_fields | [
"Uses",
"the",
"more",
"printable",
"names",
"in"
] | d0f17660bc26d18e27fd86952a84c4a6164689ec | https://github.com/oleander/git-fame-rb/blob/d0f17660bc26d18e27fd86952a84c4a6164689ec/lib/git_fame/base.rb#L260-L264 |
15,957 | oleander/git-fame-rb | lib/git_fame/base.rb | GitFame.Base.execute | def execute(command, silent = false, &block)
result = run_with_timeout(command)
if result.success? or silent
warn command if @verbose
return result unless block
return block.call(result)
end
raise Error, cmd_error_message(command, result.data)
rescue Errno::ENOENT
... | ruby | def execute(command, silent = false, &block)
result = run_with_timeout(command)
if result.success? or silent
warn command if @verbose
return result unless block
return block.call(result)
end
raise Error, cmd_error_message(command, result.data)
rescue Errno::ENOENT
... | [
"def",
"execute",
"(",
"command",
",",
"silent",
"=",
"false",
",",
"&",
"block",
")",
"result",
"=",
"run_with_timeout",
"(",
"command",
")",
"if",
"result",
".",
"success?",
"or",
"silent",
"warn",
"command",
"if",
"@verbose",
"return",
"result",
"unless... | Command to be executed at @repository
@silent = true wont raise an error on exit code =! 0 | [
"Command",
"to",
"be",
"executed",
"at"
] | d0f17660bc26d18e27fd86952a84c4a6164689ec | https://github.com/oleander/git-fame-rb/blob/d0f17660bc26d18e27fd86952a84c4a6164689ec/lib/git_fame/base.rb#L313-L323 |
15,958 | oleander/git-fame-rb | lib/git_fame/base.rb | GitFame.Base.current_files | def current_files
if commit_range.is_range?
execute("git #{git_directory_params} -c diff.renames=0 -c diff.renameLimit=1000 diff -M -C -c --name-only --ignore-submodules=all --diff-filter=AM #{encoding_opt} #{default_params} #{commit_range.to_s}") do |result|
filter_files(result.to_s.split(/\n/)... | ruby | def current_files
if commit_range.is_range?
execute("git #{git_directory_params} -c diff.renames=0 -c diff.renameLimit=1000 diff -M -C -c --name-only --ignore-submodules=all --diff-filter=AM #{encoding_opt} #{default_params} #{commit_range.to_s}") do |result|
filter_files(result.to_s.split(/\n/)... | [
"def",
"current_files",
"if",
"commit_range",
".",
"is_range?",
"execute",
"(",
"\"git #{git_directory_params} -c diff.renames=0 -c diff.renameLimit=1000 diff -M -C -c --name-only --ignore-submodules=all --diff-filter=AM #{encoding_opt} #{default_params} #{commit_range.to_s}\"",
")",
"do",
"|"... | List all files in current git directory, excluding
extensions in @extensions defined by the user | [
"List",
"all",
"files",
"in",
"current",
"git",
"directory",
"excluding",
"extensions",
"in"
] | d0f17660bc26d18e27fd86952a84c4a6164689ec | https://github.com/oleander/git-fame-rb/blob/d0f17660bc26d18e27fd86952a84c4a6164689ec/lib/git_fame/base.rb#L380-L391 |
15,959 | tristandunn/pusher-fake | lib/pusher-fake/configuration.rb | PusherFake.Configuration.to_options | def to_options(options = {})
options.merge(
wsHost: socket_options[:host],
wsPort: socket_options[:port],
cluster: "us-east-1",
disableStats: disable_stats
)
end | ruby | def to_options(options = {})
options.merge(
wsHost: socket_options[:host],
wsPort: socket_options[:port],
cluster: "us-east-1",
disableStats: disable_stats
)
end | [
"def",
"to_options",
"(",
"options",
"=",
"{",
"}",
")",
"options",
".",
"merge",
"(",
"wsHost",
":",
"socket_options",
"[",
":host",
"]",
",",
"wsPort",
":",
"socket_options",
"[",
":port",
"]",
",",
"cluster",
":",
"\"us-east-1\"",
",",
"disableStats",
... | Convert the configuration to a hash sutiable for Pusher JS options.
@param [Hash] options Custom options for Pusher client. | [
"Convert",
"the",
"configuration",
"to",
"a",
"hash",
"sutiable",
"for",
"Pusher",
"JS",
"options",
"."
] | 7bd5df7253c0bff4b39f0e4eac9891ba6a1735c4 | https://github.com/tristandunn/pusher-fake/blob/7bd5df7253c0bff4b39f0e4eac9891ba6a1735c4/lib/pusher-fake/configuration.rb#L63-L70 |
15,960 | tristandunn/pusher-fake | lib/pusher-fake/connection.rb | PusherFake.Connection.emit | def emit(event, data = {}, channel = nil)
message = { event: event, data: MultiJson.dump(data) }
message[:channel] = channel if channel
PusherFake.log("SEND #{id}: #{message}")
socket.send(MultiJson.dump(message))
end | ruby | def emit(event, data = {}, channel = nil)
message = { event: event, data: MultiJson.dump(data) }
message[:channel] = channel if channel
PusherFake.log("SEND #{id}: #{message}")
socket.send(MultiJson.dump(message))
end | [
"def",
"emit",
"(",
"event",
",",
"data",
"=",
"{",
"}",
",",
"channel",
"=",
"nil",
")",
"message",
"=",
"{",
"event",
":",
"event",
",",
"data",
":",
"MultiJson",
".",
"dump",
"(",
"data",
")",
"}",
"message",
"[",
":channel",
"]",
"=",
"channe... | Emit an event to the connection.
@param [String] event The event name.
@param [Hash] data The event data.
@param [String] channel The channel name. | [
"Emit",
"an",
"event",
"to",
"the",
"connection",
"."
] | 7bd5df7253c0bff4b39f0e4eac9891ba6a1735c4 | https://github.com/tristandunn/pusher-fake/blob/7bd5df7253c0bff4b39f0e4eac9891ba6a1735c4/lib/pusher-fake/connection.rb#L32-L39 |
15,961 | tristandunn/pusher-fake | lib/pusher-fake/connection.rb | PusherFake.Connection.process | def process(data)
message = MultiJson.load(data, symbolize_keys: true)
event = message[:event]
PusherFake.log("RECV #{id}: #{message}")
if event.start_with?(CLIENT_EVENT_PREFIX)
process_trigger(event, message)
else
process_event(event, message)
end
end | ruby | def process(data)
message = MultiJson.load(data, symbolize_keys: true)
event = message[:event]
PusherFake.log("RECV #{id}: #{message}")
if event.start_with?(CLIENT_EVENT_PREFIX)
process_trigger(event, message)
else
process_event(event, message)
end
end | [
"def",
"process",
"(",
"data",
")",
"message",
"=",
"MultiJson",
".",
"load",
"(",
"data",
",",
"symbolize_keys",
":",
"true",
")",
"event",
"=",
"message",
"[",
":event",
"]",
"PusherFake",
".",
"log",
"(",
"\"RECV #{id}: #{message}\"",
")",
"if",
"event"... | Process an event.
@param [String] data The event data as JSON. | [
"Process",
"an",
"event",
"."
] | 7bd5df7253c0bff4b39f0e4eac9891ba6a1735c4 | https://github.com/tristandunn/pusher-fake/blob/7bd5df7253c0bff4b39f0e4eac9891ba6a1735c4/lib/pusher-fake/connection.rb#L50-L61 |
15,962 | tilfin/ougai | lib/ougai/logging.rb | Ougai.Logging.trace | def trace(message = nil, ex = nil, data = nil, &block)
log(TRACE, message, ex, data, block)
end | ruby | def trace(message = nil, ex = nil, data = nil, &block)
log(TRACE, message, ex, data, block)
end | [
"def",
"trace",
"(",
"message",
"=",
"nil",
",",
"ex",
"=",
"nil",
",",
"data",
"=",
"nil",
",",
"&",
"block",
")",
"log",
"(",
"TRACE",
",",
"message",
",",
"ex",
",",
"data",
",",
"block",
")",
"end"
] | Log any one or more of a message, an exception and structured data as TRACE.
@return [Boolean] true
@see Logging#debug | [
"Log",
"any",
"one",
"or",
"more",
"of",
"a",
"message",
"an",
"exception",
"and",
"structured",
"data",
"as",
"TRACE",
"."
] | 884d8cfebcb9fb4abc3e71571a7f7b132966b561 | https://github.com/tilfin/ougai/blob/884d8cfebcb9fb4abc3e71571a7f7b132966b561/lib/ougai/logging.rb#L24-L26 |
15,963 | tilfin/ougai | lib/ougai/logging.rb | Ougai.Logging.debug | def debug(message = nil, ex = nil, data = nil, &block)
log(DEBUG, message, ex, data, block)
end | ruby | def debug(message = nil, ex = nil, data = nil, &block)
log(DEBUG, message, ex, data, block)
end | [
"def",
"debug",
"(",
"message",
"=",
"nil",
",",
"ex",
"=",
"nil",
",",
"data",
"=",
"nil",
",",
"&",
"block",
")",
"log",
"(",
"DEBUG",
",",
"message",
",",
"ex",
",",
"data",
",",
"block",
")",
"end"
] | Log any one or more of a message, an exception and structured data as DEBUG.
If the block is given for delay evaluation, it returns them as an array or the one of them as a value.
@param message [String] The message to log. Use default_message if not specified.
@param ex [Exception] The exception or the error
@para... | [
"Log",
"any",
"one",
"or",
"more",
"of",
"a",
"message",
"an",
"exception",
"and",
"structured",
"data",
"as",
"DEBUG",
".",
"If",
"the",
"block",
"is",
"given",
"for",
"delay",
"evaluation",
"it",
"returns",
"them",
"as",
"an",
"array",
"or",
"the",
"... | 884d8cfebcb9fb4abc3e71571a7f7b132966b561 | https://github.com/tilfin/ougai/blob/884d8cfebcb9fb4abc3e71571a7f7b132966b561/lib/ougai/logging.rb#L35-L37 |
15,964 | tilfin/ougai | lib/ougai/logging.rb | Ougai.Logging.info | def info(message = nil, ex = nil, data = nil, &block)
log(INFO, message, ex, data, block)
end | ruby | def info(message = nil, ex = nil, data = nil, &block)
log(INFO, message, ex, data, block)
end | [
"def",
"info",
"(",
"message",
"=",
"nil",
",",
"ex",
"=",
"nil",
",",
"data",
"=",
"nil",
",",
"&",
"block",
")",
"log",
"(",
"INFO",
",",
"message",
",",
"ex",
",",
"data",
",",
"block",
")",
"end"
] | Log any one or more of a message, an exception and structured data as INFO.
@return [Boolean] true
@see Logging#debug | [
"Log",
"any",
"one",
"or",
"more",
"of",
"a",
"message",
"an",
"exception",
"and",
"structured",
"data",
"as",
"INFO",
"."
] | 884d8cfebcb9fb4abc3e71571a7f7b132966b561 | https://github.com/tilfin/ougai/blob/884d8cfebcb9fb4abc3e71571a7f7b132966b561/lib/ougai/logging.rb#L42-L44 |
15,965 | tilfin/ougai | lib/ougai/logging.rb | Ougai.Logging.warn | def warn(message = nil, ex = nil, data = nil, &block)
log(WARN, message, ex, data, block)
end | ruby | def warn(message = nil, ex = nil, data = nil, &block)
log(WARN, message, ex, data, block)
end | [
"def",
"warn",
"(",
"message",
"=",
"nil",
",",
"ex",
"=",
"nil",
",",
"data",
"=",
"nil",
",",
"&",
"block",
")",
"log",
"(",
"WARN",
",",
"message",
",",
"ex",
",",
"data",
",",
"block",
")",
"end"
] | Log any one or more of a message, an exception and structured data as WARN.
@return [Boolean] true
@see Logging#debug | [
"Log",
"any",
"one",
"or",
"more",
"of",
"a",
"message",
"an",
"exception",
"and",
"structured",
"data",
"as",
"WARN",
"."
] | 884d8cfebcb9fb4abc3e71571a7f7b132966b561 | https://github.com/tilfin/ougai/blob/884d8cfebcb9fb4abc3e71571a7f7b132966b561/lib/ougai/logging.rb#L49-L51 |
15,966 | tilfin/ougai | lib/ougai/logging.rb | Ougai.Logging.error | def error(message = nil, ex = nil, data = nil, &block)
log(ERROR, message, ex, data, block)
end | ruby | def error(message = nil, ex = nil, data = nil, &block)
log(ERROR, message, ex, data, block)
end | [
"def",
"error",
"(",
"message",
"=",
"nil",
",",
"ex",
"=",
"nil",
",",
"data",
"=",
"nil",
",",
"&",
"block",
")",
"log",
"(",
"ERROR",
",",
"message",
",",
"ex",
",",
"data",
",",
"block",
")",
"end"
] | Log any one or more of a message, an exception and structured data as ERROR.
@return [Boolean] true
@see Logging#debug | [
"Log",
"any",
"one",
"or",
"more",
"of",
"a",
"message",
"an",
"exception",
"and",
"structured",
"data",
"as",
"ERROR",
"."
] | 884d8cfebcb9fb4abc3e71571a7f7b132966b561 | https://github.com/tilfin/ougai/blob/884d8cfebcb9fb4abc3e71571a7f7b132966b561/lib/ougai/logging.rb#L56-L58 |
15,967 | tilfin/ougai | lib/ougai/logging.rb | Ougai.Logging.fatal | def fatal(message = nil, ex = nil, data = nil, &block)
log(FATAL, message, ex, data, block)
end | ruby | def fatal(message = nil, ex = nil, data = nil, &block)
log(FATAL, message, ex, data, block)
end | [
"def",
"fatal",
"(",
"message",
"=",
"nil",
",",
"ex",
"=",
"nil",
",",
"data",
"=",
"nil",
",",
"&",
"block",
")",
"log",
"(",
"FATAL",
",",
"message",
",",
"ex",
",",
"data",
",",
"block",
")",
"end"
] | Log any one or more of a message, an exception and structured data as FATAL.
@return [Boolean] true
@see Logging#debug | [
"Log",
"any",
"one",
"or",
"more",
"of",
"a",
"message",
"an",
"exception",
"and",
"structured",
"data",
"as",
"FATAL",
"."
] | 884d8cfebcb9fb4abc3e71571a7f7b132966b561 | https://github.com/tilfin/ougai/blob/884d8cfebcb9fb4abc3e71571a7f7b132966b561/lib/ougai/logging.rb#L63-L65 |
15,968 | tilfin/ougai | lib/ougai/logging.rb | Ougai.Logging.unknown | def unknown(message = nil, ex = nil, data = nil, &block)
args = block ? yield : [message, ex, data]
append(UNKNOWN, args)
end | ruby | def unknown(message = nil, ex = nil, data = nil, &block)
args = block ? yield : [message, ex, data]
append(UNKNOWN, args)
end | [
"def",
"unknown",
"(",
"message",
"=",
"nil",
",",
"ex",
"=",
"nil",
",",
"data",
"=",
"nil",
",",
"&",
"block",
")",
"args",
"=",
"block",
"?",
"yield",
":",
"[",
"message",
",",
"ex",
",",
"data",
"]",
"append",
"(",
"UNKNOWN",
",",
"args",
"... | Log any one or more of a message, an exception and structured data as UNKNOWN.
@return [Boolean] true
@see Logging#debug | [
"Log",
"any",
"one",
"or",
"more",
"of",
"a",
"message",
"an",
"exception",
"and",
"structured",
"data",
"as",
"UNKNOWN",
"."
] | 884d8cfebcb9fb4abc3e71571a7f7b132966b561 | https://github.com/tilfin/ougai/blob/884d8cfebcb9fb4abc3e71571a7f7b132966b561/lib/ougai/logging.rb#L70-L73 |
15,969 | r-cochran/cuke_sniffer | lib/cuke_sniffer/cli.rb | CukeSniffer.CLI.catalog_step_calls | def catalog_step_calls
puts "\nCataloging Step Calls: "
steps = CukeSniffer::CukeSnifferHelper.get_all_steps(@features, @step_definitions)
steps_map = build_steps_map(steps)
@step_definitions.each do |step_definition|
print '.'
calls = steps_map.find_all {|step, location| step =~... | ruby | def catalog_step_calls
puts "\nCataloging Step Calls: "
steps = CukeSniffer::CukeSnifferHelper.get_all_steps(@features, @step_definitions)
steps_map = build_steps_map(steps)
@step_definitions.each do |step_definition|
print '.'
calls = steps_map.find_all {|step, location| step =~... | [
"def",
"catalog_step_calls",
"puts",
"\"\\nCataloging Step Calls: \"",
"steps",
"=",
"CukeSniffer",
"::",
"CukeSnifferHelper",
".",
"get_all_steps",
"(",
"@features",
",",
"@step_definitions",
")",
"steps_map",
"=",
"build_steps_map",
"(",
"steps",
")",
"@step_definitions... | Determines all normal and nested step calls and assigns them to the corresponding step definition.
Does direct and fuzzy matching | [
"Determines",
"all",
"normal",
"and",
"nested",
"step",
"calls",
"and",
"assigns",
"them",
"to",
"the",
"corresponding",
"step",
"definition",
".",
"Does",
"direct",
"and",
"fuzzy",
"matching"
] | a4fa217c3074b6a172c9be4833d9d5099dc5c317 | https://github.com/r-cochran/cuke_sniffer/blob/a4fa217c3074b6a172c9be4833d9d5099dc5c317/lib/cuke_sniffer/cli.rb#L171-L184 |
15,970 | tech-angels/vandamme | lib/vandamme/parser.rb | Vandamme.Parser.parse | def parse
@changelog.scan(@version_header_exp) do |match|
version_content = $~.post_match
changelog_scanner = StringScanner.new(version_content)
changelog_scanner.scan_until(@version_header_exp)
@changelog_hash[match[@match_group]] = (changelog_scanner.pre_match || version_content)... | ruby | def parse
@changelog.scan(@version_header_exp) do |match|
version_content = $~.post_match
changelog_scanner = StringScanner.new(version_content)
changelog_scanner.scan_until(@version_header_exp)
@changelog_hash[match[@match_group]] = (changelog_scanner.pre_match || version_content)... | [
"def",
"parse",
"@changelog",
".",
"scan",
"(",
"@version_header_exp",
")",
"do",
"|",
"match",
"|",
"version_content",
"=",
"$~",
".",
"post_match",
"changelog_scanner",
"=",
"StringScanner",
".",
"new",
"(",
"version_content",
")",
"changelog_scanner",
".",
"s... | Create a new changelog parser
Options:
* +changelog+:: Changelog content as a +String+.
* +version_header_exp+ (optional):: regexp to match the starting line of version.
Defaults to /^#{0,3} ?([\w\d\.-]+\.[\w\d\.-]+[a-zA-Z0-9])(?: \/ (\w+ \d{1,2}(?:st|nd|rd|th)?,\s\d{4}|\d{4}-\d{2}-\d{2}|\w+))?\n?[=-]*/
See h... | [
"Create",
"a",
"new",
"changelog",
"parser"
] | 9bc3c0651713b24530aed1eb0f4fd9be18eabcc5 | https://github.com/tech-angels/vandamme/blob/9bc3c0651713b24530aed1eb0f4fd9be18eabcc5/lib/vandamme/parser.rb#L35-L43 |
15,971 | nning/transmission-rss | lib/transmission-rss/client.rb | TransmissionRSS.Client.add_torrent | def add_torrent(file, type = :url, options = {})
arguments = set_arguments_from_options(options)
case type
when :url
file = URI.encode(file) if URI.decode(file) == file
arguments.filename = file
when :file
arguments.metainfo = Base64.encode64(File.read(file))
... | ruby | def add_torrent(file, type = :url, options = {})
arguments = set_arguments_from_options(options)
case type
when :url
file = URI.encode(file) if URI.decode(file) == file
arguments.filename = file
when :file
arguments.metainfo = Base64.encode64(File.read(file))
... | [
"def",
"add_torrent",
"(",
"file",
",",
"type",
"=",
":url",
",",
"options",
"=",
"{",
"}",
")",
"arguments",
"=",
"set_arguments_from_options",
"(",
"options",
")",
"case",
"type",
"when",
":url",
"file",
"=",
"URI",
".",
"encode",
"(",
"file",
")",
"... | POST json packed torrent add command. | [
"POST",
"json",
"packed",
"torrent",
"add",
"command",
"."
] | 07baaf149d9e129e98b4cb496d808a528a59bc5b | https://github.com/nning/transmission-rss/blob/07baaf149d9e129e98b4cb496d808a528a59bc5b/lib/transmission-rss/client.rb#L46-L74 |
15,972 | nning/transmission-rss | lib/transmission-rss/client.rb | TransmissionRSS.Client.get_session_id | def get_session_id
get = Net::HTTP::Get.new(@rpc_path)
add_basic_auth(get)
response = request(get)
id = response.header['x-transmission-session-id']
if id.nil?
@log.debug("could not obtain session id (#{response.code}, " +
"#{response.class})")
else
@log... | ruby | def get_session_id
get = Net::HTTP::Get.new(@rpc_path)
add_basic_auth(get)
response = request(get)
id = response.header['x-transmission-session-id']
if id.nil?
@log.debug("could not obtain session id (#{response.code}, " +
"#{response.class})")
else
@log... | [
"def",
"get_session_id",
"get",
"=",
"Net",
"::",
"HTTP",
"::",
"Get",
".",
"new",
"(",
"@rpc_path",
")",
"add_basic_auth",
"(",
"get",
")",
"response",
"=",
"request",
"(",
"get",
")",
"id",
"=",
"response",
".",
"header",
"[",
"'x-transmission-session-id... | Get transmission session id. | [
"Get",
"transmission",
"session",
"id",
"."
] | 07baaf149d9e129e98b4cb496d808a528a59bc5b | https://github.com/nning/transmission-rss/blob/07baaf149d9e129e98b4cb496d808a528a59bc5b/lib/transmission-rss/client.rb#L85-L102 |
15,973 | nning/transmission-rss | lib/transmission-rss/config.rb | TransmissionRSS.Config.merge_yaml! | def merge_yaml!(path, watch = true)
self.merge!(YAML.load_file(path))
rescue TypeError
# If YAML loading fails, .load_file returns `false`.
else
watch_file(path) if watch && linux?
end | ruby | def merge_yaml!(path, watch = true)
self.merge!(YAML.load_file(path))
rescue TypeError
# If YAML loading fails, .load_file returns `false`.
else
watch_file(path) if watch && linux?
end | [
"def",
"merge_yaml!",
"(",
"path",
",",
"watch",
"=",
"true",
")",
"self",
".",
"merge!",
"(",
"YAML",
".",
"load_file",
"(",
"path",
")",
")",
"rescue",
"TypeError",
"# If YAML loading fails, .load_file returns `false`.",
"else",
"watch_file",
"(",
"path",
")",... | Merge Config Hash with Hash from YAML file. | [
"Merge",
"Config",
"Hash",
"with",
"Hash",
"from",
"YAML",
"file",
"."
] | 07baaf149d9e129e98b4cb496d808a528a59bc5b | https://github.com/nning/transmission-rss/blob/07baaf149d9e129e98b4cb496d808a528a59bc5b/lib/transmission-rss/config.rb#L72-L78 |
15,974 | nning/transmission-rss | lib/transmission-rss/aggregator.rb | TransmissionRSS.Aggregator.run | def run(interval = 600)
@log.debug('aggregator start')
loop do
@feeds.each do |feed|
@log.debug('aggregate ' + feed.url)
options = {allow_redirections: :safe}
unless feed.validate_cert
@log.debug('aggregate certificate validation: false')
opti... | ruby | def run(interval = 600)
@log.debug('aggregator start')
loop do
@feeds.each do |feed|
@log.debug('aggregate ' + feed.url)
options = {allow_redirections: :safe}
unless feed.validate_cert
@log.debug('aggregate certificate validation: false')
opti... | [
"def",
"run",
"(",
"interval",
"=",
"600",
")",
"@log",
".",
"debug",
"(",
"'aggregator start'",
")",
"loop",
"do",
"@feeds",
".",
"each",
"do",
"|",
"feed",
"|",
"@log",
".",
"debug",
"(",
"'aggregate '",
"+",
"feed",
".",
"url",
")",
"options",
"="... | Get file enclosures from all feeds items and call on_new_item callback
with torrent file URL as argument. | [
"Get",
"file",
"enclosures",
"from",
"all",
"feeds",
"items",
"and",
"call",
"on_new_item",
"callback",
"with",
"torrent",
"file",
"URL",
"as",
"argument",
"."
] | 07baaf149d9e129e98b4cb496d808a528a59bc5b | https://github.com/nning/transmission-rss/blob/07baaf149d9e129e98b4cb496d808a528a59bc5b/lib/transmission-rss/aggregator.rb#L40-L84 |
15,975 | nning/transmission-rss | lib/transmission-rss/callback.rb | TransmissionRSS.Callback.callback | def callback(*names)
names.each do |name|
self.class_eval do
define_method name, ->(*args, &block) do
@callbacks ||= {}
if block
@callbacks[name] = block
elsif @callbacks[name]
@callbacks[name].call(*args)
end
... | ruby | def callback(*names)
names.each do |name|
self.class_eval do
define_method name, ->(*args, &block) do
@callbacks ||= {}
if block
@callbacks[name] = block
elsif @callbacks[name]
@callbacks[name].call(*args)
end
... | [
"def",
"callback",
"(",
"*",
"names",
")",
"names",
".",
"each",
"do",
"|",
"name",
"|",
"self",
".",
"class_eval",
"do",
"define_method",
"name",
",",
"->",
"(",
"*",
"args",
",",
"&",
"block",
")",
"do",
"@callbacks",
"||=",
"{",
"}",
"if",
"bloc... | Define callback method. | [
"Define",
"callback",
"method",
"."
] | 07baaf149d9e129e98b4cb496d808a528a59bc5b | https://github.com/nning/transmission-rss/blob/07baaf149d9e129e98b4cb496d808a528a59bc5b/lib/transmission-rss/callback.rb#L4-L17 |
15,976 | GoogleCloudPlatform/appengine-ruby | lib/appengine/exec.rb | AppEngine.Exec.start | def start
resolve_parameters
version_info = version_info @service, @version
env_variables = version_info["envVariables"] || {}
beta_settings = version_info["betaSettings"] || {}
cloud_sql_instances = beta_settings["cloud_sql_instances"] || []
image = version_info["deployment"]["cont... | ruby | def start
resolve_parameters
version_info = version_info @service, @version
env_variables = version_info["envVariables"] || {}
beta_settings = version_info["betaSettings"] || {}
cloud_sql_instances = beta_settings["cloud_sql_instances"] || []
image = version_info["deployment"]["cont... | [
"def",
"start",
"resolve_parameters",
"version_info",
"=",
"version_info",
"@service",
",",
"@version",
"env_variables",
"=",
"version_info",
"[",
"\"envVariables\"",
"]",
"||",
"{",
"}",
"beta_settings",
"=",
"version_info",
"[",
"\"betaSettings\"",
"]",
"||",
"{",... | Executes the command synchronously. Streams the logs back to standard out
and does not return until the command has completed or timed out. | [
"Executes",
"the",
"command",
"synchronously",
".",
"Streams",
"the",
"logs",
"back",
"to",
"standard",
"out",
"and",
"does",
"not",
"return",
"until",
"the",
"command",
"has",
"completed",
"or",
"timed",
"out",
"."
] | e8f6525c14ceda29013d570560880354ceb7153c | https://github.com/GoogleCloudPlatform/appengine-ruby/blob/e8f6525c14ceda29013d570560880354ceb7153c/lib/appengine/exec.rb#L288-L310 |
15,977 | lolcommits/lolcommits | lib/lolcommits/capturer/capture_windows_animated.rb | Lolcommits.CaptureWindowsAnimated.device_names | def device_names
@device_names ||= begin
names = []
cmd_output = ''
count = 0
while cmd_output.empty? || !cmd_output.split('DirectShow')[2]
cmd_output = system_call(ffpmeg_list_devices_cmd, true)
count += 1
raise 'failed to find a video captu... | ruby | def device_names
@device_names ||= begin
names = []
cmd_output = ''
count = 0
while cmd_output.empty? || !cmd_output.split('DirectShow')[2]
cmd_output = system_call(ffpmeg_list_devices_cmd, true)
count += 1
raise 'failed to find a video captu... | [
"def",
"device_names",
"@device_names",
"||=",
"begin",
"names",
"=",
"[",
"]",
"cmd_output",
"=",
"''",
"count",
"=",
"0",
"while",
"cmd_output",
".",
"empty?",
"||",
"!",
"cmd_output",
".",
"split",
"(",
"'DirectShow'",
")",
"[",
"2",
"]",
"cmd_output",
... | inspired by this code from @rdp http://tinyurl.com/y7t276bh | [
"inspired",
"by",
"this",
"code",
"from"
] | 8569c729daff97d0b2cd328bcfb0986925f6622e | https://github.com/lolcommits/lolcommits/blob/8569c729daff97d0b2cd328bcfb0986925f6622e/lib/lolcommits/capturer/capture_windows_animated.rb#L45-L67 |
15,978 | lolcommits/lolcommits | lib/lolcommits/runner.rb | Lolcommits.Runner.run_capture | def run_capture
puts '*** Preserving this moment in history.' unless capture_stealth
self.snapshot_loc = config.raw_image(image_file_type)
self.main_image = config.main_image(sha, image_file_type)
capturer = Platform.capturer_class(capture_animated?).new(
capture_device: capture_devic... | ruby | def run_capture
puts '*** Preserving this moment in history.' unless capture_stealth
self.snapshot_loc = config.raw_image(image_file_type)
self.main_image = config.main_image(sha, image_file_type)
capturer = Platform.capturer_class(capture_animated?).new(
capture_device: capture_devic... | [
"def",
"run_capture",
"puts",
"'*** Preserving this moment in history.'",
"unless",
"capture_stealth",
"self",
".",
"snapshot_loc",
"=",
"config",
".",
"raw_image",
"(",
"image_file_type",
")",
"self",
".",
"main_image",
"=",
"config",
".",
"main_image",
"(",
"sha",
... | the main capture | [
"the",
"main",
"capture"
] | 8569c729daff97d0b2cd328bcfb0986925f6622e | https://github.com/lolcommits/lolcommits/blob/8569c729daff97d0b2cd328bcfb0986925f6622e/lib/lolcommits/runner.rb#L71-L85 |
15,979 | weshatheleopard/rubyXL | lib/rubyXL/objects/column_range.rb | RubyXL.ColumnRanges.get_range | def get_range(col_index)
col_num = col_index + 1
old_range = self.locate_range(col_index)
if old_range.nil? then
new_range = RubyXL::ColumnRange.new
else
if old_range.min == col_num && old_range.max == col_num then
return old_range # Single column range, OK to change ... | ruby | def get_range(col_index)
col_num = col_index + 1
old_range = self.locate_range(col_index)
if old_range.nil? then
new_range = RubyXL::ColumnRange.new
else
if old_range.min == col_num && old_range.max == col_num then
return old_range # Single column range, OK to change ... | [
"def",
"get_range",
"(",
"col_index",
")",
"col_num",
"=",
"col_index",
"+",
"1",
"old_range",
"=",
"self",
".",
"locate_range",
"(",
"col_index",
")",
"if",
"old_range",
".",
"nil?",
"then",
"new_range",
"=",
"RubyXL",
"::",
"ColumnRange",
".",
"new",
"el... | Locate an existing column range, make a new one if not found,
or split existing column range into multiples. | [
"Locate",
"an",
"existing",
"column",
"range",
"make",
"a",
"new",
"one",
"if",
"not",
"found",
"or",
"split",
"existing",
"column",
"range",
"into",
"multiples",
"."
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/objects/column_range.rb#L45-L75 |
15,980 | weshatheleopard/rubyXL | lib/rubyXL/objects/workbook.rb | RubyXL.Workbook.save | def save(dst_file_path = nil)
dst_file_path ||= root.source_file_path
extension = File.extname(dst_file_path)
unless %w{.xlsx .xlsm}.include?(extension.downcase)
raise "Unsupported extension: #{extension} (only .xlsx and .xlsm files are supported)."
end
File.open(dst_file_path, "... | ruby | def save(dst_file_path = nil)
dst_file_path ||= root.source_file_path
extension = File.extname(dst_file_path)
unless %w{.xlsx .xlsm}.include?(extension.downcase)
raise "Unsupported extension: #{extension} (only .xlsx and .xlsm files are supported)."
end
File.open(dst_file_path, "... | [
"def",
"save",
"(",
"dst_file_path",
"=",
"nil",
")",
"dst_file_path",
"||=",
"root",
".",
"source_file_path",
"extension",
"=",
"File",
".",
"extname",
"(",
"dst_file_path",
")",
"unless",
"%w{",
".xlsx",
".xlsm",
"}",
".",
"include?",
"(",
"extension",
"."... | Save the resulting XLSX file to the specified location | [
"Save",
"the",
"resulting",
"XLSX",
"file",
"to",
"the",
"specified",
"location"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/objects/workbook.rb#L390-L401 |
15,981 | weshatheleopard/rubyXL | lib/rubyXL/objects/workbook.rb | RubyXL.Workbook.[] | def [](ind)
case ind
when Integer then worksheets[ind]
when String then worksheets.find { |ws| ws.sheet_name == ind }
end
end | ruby | def [](ind)
case ind
when Integer then worksheets[ind]
when String then worksheets.find { |ws| ws.sheet_name == ind }
end
end | [
"def",
"[]",
"(",
"ind",
")",
"case",
"ind",
"when",
"Integer",
"then",
"worksheets",
"[",
"ind",
"]",
"when",
"String",
"then",
"worksheets",
".",
"find",
"{",
"|",
"ws",
"|",
"ws",
".",
"sheet_name",
"==",
"ind",
"}",
"end",
"end"
] | Finds worksheet by its name or numerical index | [
"Finds",
"worksheet",
"by",
"its",
"name",
"or",
"numerical",
"index"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/objects/workbook.rb#L463-L468 |
15,982 | weshatheleopard/rubyXL | lib/rubyXL/objects/workbook.rb | RubyXL.Workbook.add_worksheet | def add_worksheet(name = nil)
if name.nil? then
n = 0
begin
name = SHEET_NAME_TEMPLATE % (n += 1)
end until self[name].nil?
end
new_worksheet = Worksheet.new(:workbook => self, :sheet_name => name)
worksheets << new_worksheet
new_worksheet
end | ruby | def add_worksheet(name = nil)
if name.nil? then
n = 0
begin
name = SHEET_NAME_TEMPLATE % (n += 1)
end until self[name].nil?
end
new_worksheet = Worksheet.new(:workbook => self, :sheet_name => name)
worksheets << new_worksheet
new_worksheet
end | [
"def",
"add_worksheet",
"(",
"name",
"=",
"nil",
")",
"if",
"name",
".",
"nil?",
"then",
"n",
"=",
"0",
"begin",
"name",
"=",
"SHEET_NAME_TEMPLATE",
"%",
"(",
"n",
"+=",
"1",
")",
"end",
"until",
"self",
"[",
"name",
"]",
".",
"nil?",
"end",
"new_w... | Create new simple worksheet and add it to the workbook worksheets
@param [String] The name for the new worksheet | [
"Create",
"new",
"simple",
"worksheet",
"and",
"add",
"it",
"to",
"the",
"workbook",
"worksheets"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/objects/workbook.rb#L473-L485 |
15,983 | weshatheleopard/rubyXL | lib/rubyXL/worksheet.rb | RubyXL.LegacyWorksheet.validate_workbook | def validate_workbook()
unless @workbook.nil? || @workbook.worksheets.nil?
return if @workbook.worksheets.any? { |sheet| sheet.equal?(self) }
end
raise "This worksheet #{self} is not in workbook #{@workbook}"
end | ruby | def validate_workbook()
unless @workbook.nil? || @workbook.worksheets.nil?
return if @workbook.worksheets.any? { |sheet| sheet.equal?(self) }
end
raise "This worksheet #{self} is not in workbook #{@workbook}"
end | [
"def",
"validate_workbook",
"(",
")",
"unless",
"@workbook",
".",
"nil?",
"||",
"@workbook",
".",
"worksheets",
".",
"nil?",
"return",
"if",
"@workbook",
".",
"worksheets",
".",
"any?",
"{",
"|",
"sheet",
"|",
"sheet",
".",
"equal?",
"(",
"self",
")",
"}... | validates Workbook, ensures that this worksheet is in @workbook | [
"validates",
"Workbook",
"ensures",
"that",
"this",
"worksheet",
"is",
"in"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/worksheet.rb#L73-L79 |
15,984 | weshatheleopard/rubyXL | lib/rubyXL/worksheet.rb | RubyXL.LegacyWorksheet.ensure_cell_exists | def ensure_cell_exists(row_index, column_index = 0)
validate_nonnegative(row_index)
validate_nonnegative(column_index)
sheet_data.rows[row_index] || add_row(row_index)
end | ruby | def ensure_cell_exists(row_index, column_index = 0)
validate_nonnegative(row_index)
validate_nonnegative(column_index)
sheet_data.rows[row_index] || add_row(row_index)
end | [
"def",
"ensure_cell_exists",
"(",
"row_index",
",",
"column_index",
"=",
"0",
")",
"validate_nonnegative",
"(",
"row_index",
")",
"validate_nonnegative",
"(",
"column_index",
")",
"sheet_data",
".",
"rows",
"[",
"row_index",
"]",
"||",
"add_row",
"(",
"row_index",... | Ensures that storage space for a cell with +row_index+ and +column_index+
exists in +sheet_data+ arrays, growing them up if necessary. | [
"Ensures",
"that",
"storage",
"space",
"for",
"a",
"cell",
"with",
"+",
"row_index",
"+",
"and",
"+",
"column_index",
"+",
"exists",
"in",
"+",
"sheet_data",
"+",
"arrays",
"growing",
"them",
"up",
"if",
"necessary",
"."
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/worksheet.rb#L83-L88 |
15,985 | weshatheleopard/rubyXL | lib/rubyXL/convenience_methods/cell.rb | RubyXL.CellConvenienceMethods.change_fill | def change_fill(rgb = 'ffffff')
validate_worksheet
Color.validate_color(rgb)
self.style_index = workbook.modify_fill(self.style_index, rgb)
end | ruby | def change_fill(rgb = 'ffffff')
validate_worksheet
Color.validate_color(rgb)
self.style_index = workbook.modify_fill(self.style_index, rgb)
end | [
"def",
"change_fill",
"(",
"rgb",
"=",
"'ffffff'",
")",
"validate_worksheet",
"Color",
".",
"validate_color",
"(",
"rgb",
")",
"self",
".",
"style_index",
"=",
"workbook",
".",
"modify_fill",
"(",
"self",
".",
"style_index",
",",
"rgb",
")",
"end"
] | Changes fill color of cell | [
"Changes",
"fill",
"color",
"of",
"cell"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/convenience_methods/cell.rb#L151-L155 |
15,986 | weshatheleopard/rubyXL | lib/rubyXL/convenience_methods/cell.rb | RubyXL.CellConvenienceMethods.change_font_name | def change_font_name(new_font_name = 'Verdana')
validate_worksheet
font = get_cell_font.dup
font.set_name(new_font_name)
update_font_references(font)
end | ruby | def change_font_name(new_font_name = 'Verdana')
validate_worksheet
font = get_cell_font.dup
font.set_name(new_font_name)
update_font_references(font)
end | [
"def",
"change_font_name",
"(",
"new_font_name",
"=",
"'Verdana'",
")",
"validate_worksheet",
"font",
"=",
"get_cell_font",
".",
"dup",
"font",
".",
"set_name",
"(",
"new_font_name",
")",
"update_font_references",
"(",
"font",
")",
"end"
] | Changes font name of cell | [
"Changes",
"font",
"name",
"of",
"cell"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/convenience_methods/cell.rb#L158-L164 |
15,987 | weshatheleopard/rubyXL | lib/rubyXL/convenience_methods/cell.rb | RubyXL.CellConvenienceMethods.change_font_size | def change_font_size(font_size = 10)
validate_worksheet
raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)
font = get_cell_font.dup
font.set_size(font_size)
update_font_references(font)
end | ruby | def change_font_size(font_size = 10)
validate_worksheet
raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)
font = get_cell_font.dup
font.set_size(font_size)
update_font_references(font)
end | [
"def",
"change_font_size",
"(",
"font_size",
"=",
"10",
")",
"validate_worksheet",
"raise",
"'Argument must be a number'",
"unless",
"font_size",
".",
"is_a?",
"(",
"Integer",
")",
"||",
"font_size",
".",
"is_a?",
"(",
"Float",
")",
"font",
"=",
"get_cell_font",
... | Changes font size of cell | [
"Changes",
"font",
"size",
"of",
"cell"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/convenience_methods/cell.rb#L167-L174 |
15,988 | weshatheleopard/rubyXL | lib/rubyXL/convenience_methods/cell.rb | RubyXL.CellConvenienceMethods.change_font_color | def change_font_color(font_color = '000000')
validate_worksheet
Color.validate_color(font_color)
font = get_cell_font.dup
font.set_rgb_color(font_color)
update_font_references(font)
end | ruby | def change_font_color(font_color = '000000')
validate_worksheet
Color.validate_color(font_color)
font = get_cell_font.dup
font.set_rgb_color(font_color)
update_font_references(font)
end | [
"def",
"change_font_color",
"(",
"font_color",
"=",
"'000000'",
")",
"validate_worksheet",
"Color",
".",
"validate_color",
"(",
"font_color",
")",
"font",
"=",
"get_cell_font",
".",
"dup",
"font",
".",
"set_rgb_color",
"(",
"font_color",
")",
"update_font_references... | Changes font color of cell | [
"Changes",
"font",
"color",
"of",
"cell"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/convenience_methods/cell.rb#L177-L184 |
15,989 | weshatheleopard/rubyXL | lib/rubyXL/convenience_methods/cell.rb | RubyXL.CellConvenienceMethods.change_font_italics | def change_font_italics(italicized = false)
validate_worksheet
font = get_cell_font.dup
font.set_italic(italicized)
update_font_references(font)
end | ruby | def change_font_italics(italicized = false)
validate_worksheet
font = get_cell_font.dup
font.set_italic(italicized)
update_font_references(font)
end | [
"def",
"change_font_italics",
"(",
"italicized",
"=",
"false",
")",
"validate_worksheet",
"font",
"=",
"get_cell_font",
".",
"dup",
"font",
".",
"set_italic",
"(",
"italicized",
")",
"update_font_references",
"(",
"font",
")",
"end"
] | Changes font italics settings of cell | [
"Changes",
"font",
"italics",
"settings",
"of",
"cell"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/convenience_methods/cell.rb#L187-L193 |
15,990 | weshatheleopard/rubyXL | lib/rubyXL/convenience_methods/cell.rb | RubyXL.CellConvenienceMethods.change_font_bold | def change_font_bold(bolded = false)
validate_worksheet
font = get_cell_font.dup
font.set_bold(bolded)
update_font_references(font)
end | ruby | def change_font_bold(bolded = false)
validate_worksheet
font = get_cell_font.dup
font.set_bold(bolded)
update_font_references(font)
end | [
"def",
"change_font_bold",
"(",
"bolded",
"=",
"false",
")",
"validate_worksheet",
"font",
"=",
"get_cell_font",
".",
"dup",
"font",
".",
"set_bold",
"(",
"bolded",
")",
"update_font_references",
"(",
"font",
")",
"end"
] | Changes font bold settings of cell | [
"Changes",
"font",
"bold",
"settings",
"of",
"cell"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/convenience_methods/cell.rb#L196-L202 |
15,991 | weshatheleopard/rubyXL | lib/rubyXL/convenience_methods/cell.rb | RubyXL.CellConvenienceMethods.change_font_underline | def change_font_underline(underlined = false)
validate_worksheet
font = get_cell_font.dup
font.set_underline(underlined)
update_font_references(font)
end | ruby | def change_font_underline(underlined = false)
validate_worksheet
font = get_cell_font.dup
font.set_underline(underlined)
update_font_references(font)
end | [
"def",
"change_font_underline",
"(",
"underlined",
"=",
"false",
")",
"validate_worksheet",
"font",
"=",
"get_cell_font",
".",
"dup",
"font",
".",
"set_underline",
"(",
"underlined",
")",
"update_font_references",
"(",
"font",
")",
"end"
] | Changes font underline settings of cell | [
"Changes",
"font",
"underline",
"settings",
"of",
"cell"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/convenience_methods/cell.rb#L205-L211 |
15,992 | weshatheleopard/rubyXL | lib/rubyXL/convenience_methods/cell.rb | RubyXL.CellConvenienceMethods.update_font_references | def update_font_references(modified_font)
xf = workbook.register_new_font(modified_font, get_cell_xf)
self.style_index = workbook.register_new_xf(xf)
end | ruby | def update_font_references(modified_font)
xf = workbook.register_new_font(modified_font, get_cell_xf)
self.style_index = workbook.register_new_xf(xf)
end | [
"def",
"update_font_references",
"(",
"modified_font",
")",
"xf",
"=",
"workbook",
".",
"register_new_font",
"(",
"modified_font",
",",
"get_cell_xf",
")",
"self",
".",
"style_index",
"=",
"workbook",
".",
"register_new_xf",
"(",
"xf",
")",
"end"
] | Helper method to update the font array and xf array | [
"Helper",
"method",
"to",
"update",
"the",
"font",
"array",
"and",
"xf",
"array"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/convenience_methods/cell.rb#L222-L225 |
15,993 | weshatheleopard/rubyXL | lib/rubyXL/convenience_methods/cell.rb | RubyXL.CellConvenienceMethods.font_switch | def font_switch(change_type, arg)
case change_type
when Worksheet::NAME then change_font_name(arg)
when Worksheet::SIZE then change_font_size(arg)
when Worksheet::COLOR then change_font_color(arg)
when Worksheet::ITALICS then change_font_italics(arg)
w... | ruby | def font_switch(change_type, arg)
case change_type
when Worksheet::NAME then change_font_name(arg)
when Worksheet::SIZE then change_font_size(arg)
when Worksheet::COLOR then change_font_color(arg)
when Worksheet::ITALICS then change_font_italics(arg)
w... | [
"def",
"font_switch",
"(",
"change_type",
",",
"arg",
")",
"case",
"change_type",
"when",
"Worksheet",
"::",
"NAME",
"then",
"change_font_name",
"(",
"arg",
")",
"when",
"Worksheet",
"::",
"SIZE",
"then",
"change_font_size",
"(",
"arg",
")",
"when",
"Worksheet... | Performs correct modification based on what type of change_type is specified | [
"Performs",
"correct",
"modification",
"based",
"on",
"what",
"type",
"of",
"change_type",
"is",
"specified"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/convenience_methods/cell.rb#L229-L240 |
15,994 | weshatheleopard/rubyXL | lib/rubyXL/convenience_methods/worksheet.rb | RubyXL.WorksheetConvenienceMethods.get_column_width_raw | def get_column_width_raw(column_index = 0)
validate_workbook
validate_nonnegative(column_index)
range = cols.locate_range(column_index)
range && range.width
end | ruby | def get_column_width_raw(column_index = 0)
validate_workbook
validate_nonnegative(column_index)
range = cols.locate_range(column_index)
range && range.width
end | [
"def",
"get_column_width_raw",
"(",
"column_index",
"=",
"0",
")",
"validate_workbook",
"validate_nonnegative",
"(",
"column_index",
")",
"range",
"=",
"cols",
".",
"locate_range",
"(",
"column_index",
")",
"range",
"&&",
"range",
".",
"width",
"end"
] | Get raw column width value as stored in the file | [
"Get",
"raw",
"column",
"width",
"value",
"as",
"stored",
"in",
"the",
"file"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/convenience_methods/worksheet.rb#L293-L299 |
15,995 | weshatheleopard/rubyXL | lib/rubyXL/convenience_methods/worksheet.rb | RubyXL.WorksheetConvenienceMethods.change_column_width_raw | def change_column_width_raw(column_index, width)
validate_workbook
ensure_cell_exists(0, column_index)
range = cols.get_range(column_index)
range.width = width
range.custom_width = true
end | ruby | def change_column_width_raw(column_index, width)
validate_workbook
ensure_cell_exists(0, column_index)
range = cols.get_range(column_index)
range.width = width
range.custom_width = true
end | [
"def",
"change_column_width_raw",
"(",
"column_index",
",",
"width",
")",
"validate_workbook",
"ensure_cell_exists",
"(",
"0",
",",
"column_index",
")",
"range",
"=",
"cols",
".",
"get_range",
"(",
"column_index",
")",
"range",
".",
"width",
"=",
"width",
"range... | Set raw column width value | [
"Set",
"raw",
"column",
"width",
"value"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/convenience_methods/worksheet.rb#L310-L316 |
15,996 | weshatheleopard/rubyXL | lib/rubyXL/convenience_methods/worksheet.rb | RubyXL.WorksheetConvenienceMethods.change_row_font | def change_row_font(row_index, change_type, arg, font)
validate_workbook
ensure_cell_exists(row_index)
xf = workbook.register_new_font(font, get_row_xf(row_index))
row = sheet_data[row_index]
row.style_index = workbook.register_new_xf(xf)
row.cells.each { |c| c.font_switch(change_ty... | ruby | def change_row_font(row_index, change_type, arg, font)
validate_workbook
ensure_cell_exists(row_index)
xf = workbook.register_new_font(font, get_row_xf(row_index))
row = sheet_data[row_index]
row.style_index = workbook.register_new_xf(xf)
row.cells.each { |c| c.font_switch(change_ty... | [
"def",
"change_row_font",
"(",
"row_index",
",",
"change_type",
",",
"arg",
",",
"font",
")",
"validate_workbook",
"ensure_cell_exists",
"(",
"row_index",
")",
"xf",
"=",
"workbook",
".",
"register_new_font",
"(",
"font",
",",
"get_row_xf",
"(",
"row_index",
")"... | Helper method to update the row styles array
change_type - NAME or SIZE or COLOR etc
main method to change font, called from each separate font mutator method | [
"Helper",
"method",
"to",
"update",
"the",
"row",
"styles",
"array",
"change_type",
"-",
"NAME",
"or",
"SIZE",
"or",
"COLOR",
"etc",
"main",
"method",
"to",
"change",
"font",
"called",
"from",
"each",
"separate",
"font",
"mutator",
"method"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/convenience_methods/worksheet.rb#L428-L436 |
15,997 | weshatheleopard/rubyXL | lib/rubyXL/convenience_methods/worksheet.rb | RubyXL.WorksheetConvenienceMethods.change_column_font | def change_column_font(column_index, change_type, arg, font, xf)
validate_workbook
ensure_cell_exists(0, column_index)
xf = workbook.register_new_font(font, xf)
cols.get_range(column_index).style_index = workbook.register_new_xf(xf)
sheet_data.rows.each { |row|
c = row && row[col... | ruby | def change_column_font(column_index, change_type, arg, font, xf)
validate_workbook
ensure_cell_exists(0, column_index)
xf = workbook.register_new_font(font, xf)
cols.get_range(column_index).style_index = workbook.register_new_xf(xf)
sheet_data.rows.each { |row|
c = row && row[col... | [
"def",
"change_column_font",
"(",
"column_index",
",",
"change_type",
",",
"arg",
",",
"font",
",",
"xf",
")",
"validate_workbook",
"ensure_cell_exists",
"(",
"0",
",",
"column_index",
")",
"xf",
"=",
"workbook",
".",
"register_new_font",
"(",
"font",
",",
"xf... | Helper method to update the fonts and cell styles array
main method to change font, called from each separate font mutator method | [
"Helper",
"method",
"to",
"update",
"the",
"fonts",
"and",
"cell",
"styles",
"array",
"main",
"method",
"to",
"change",
"font",
"called",
"from",
"each",
"separate",
"font",
"mutator",
"method"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/convenience_methods/worksheet.rb#L499-L510 |
15,998 | weshatheleopard/rubyXL | lib/rubyXL/convenience_methods/worksheet.rb | RubyXL.WorksheetConvenienceMethods.merge_cells | def merge_cells(start_row, start_col, end_row, end_col)
validate_workbook
self.merged_cells ||= RubyXL::MergedCells.new
# TODO: add validation to make sure ranges are not intersecting with existing ones
merged_cells << RubyXL::MergedCell.new(:ref => RubyXL::Reference.new(start_row, end_row, sta... | ruby | def merge_cells(start_row, start_col, end_row, end_col)
validate_workbook
self.merged_cells ||= RubyXL::MergedCells.new
# TODO: add validation to make sure ranges are not intersecting with existing ones
merged_cells << RubyXL::MergedCell.new(:ref => RubyXL::Reference.new(start_row, end_row, sta... | [
"def",
"merge_cells",
"(",
"start_row",
",",
"start_col",
",",
"end_row",
",",
"end_col",
")",
"validate_workbook",
"self",
".",
"merged_cells",
"||=",
"RubyXL",
"::",
"MergedCells",
".",
"new",
"# TODO: add validation to make sure ranges are not intersecting with existing ... | Merges cells within a rectangular area | [
"Merges",
"cells",
"within",
"a",
"rectangular",
"area"
] | e61d78de9486316cdee039d3590177dc05db0f0c | https://github.com/weshatheleopard/rubyXL/blob/e61d78de9486316cdee039d3590177dc05db0f0c/lib/rubyXL/convenience_methods/worksheet.rb#L628-L634 |
15,999 | adamcooke/procodile | lib/procodile/instance.rb | Procodile.Instance.environment_variables | def environment_variables
vars = @process.environment_variables.merge({
'PROC_NAME' => self.description,
'PID_FILE' => self.pid_file_path,
'APP_ROOT' => @process.config.root
})
vars['PORT'] = @port.to_s if @port
vars
end | ruby | def environment_variables
vars = @process.environment_variables.merge({
'PROC_NAME' => self.description,
'PID_FILE' => self.pid_file_path,
'APP_ROOT' => @process.config.root
})
vars['PORT'] = @port.to_s if @port
vars
end | [
"def",
"environment_variables",
"vars",
"=",
"@process",
".",
"environment_variables",
".",
"merge",
"(",
"{",
"'PROC_NAME'",
"=>",
"self",
".",
"description",
",",
"'PID_FILE'",
"=>",
"self",
".",
"pid_file_path",
",",
"'APP_ROOT'",
"=>",
"@process",
".",
"conf... | Return an array of environment variables that should be set | [
"Return",
"an",
"array",
"of",
"environment",
"variables",
"that",
"should",
"be",
"set"
] | 57f42940715cba7186f0ce82b9bc4763f384cf2a | https://github.com/adamcooke/procodile/blob/57f42940715cba7186f0ce82b9bc4763f384cf2a/lib/procodile/instance.rb#L58-L66 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.