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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
4,100 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getFieldIDs | def getFieldIDs(dbid = nil, exclude_built_in_fields = false )
fieldIDs = []
dbid ||= @dbid
getSchema(dbid)
if @fields
@fields.each_element_with_attribute( "id" ){|f|
next if exclude_built_in_fields and isBuiltInField?(f.attributes["id"])
fieldIDs << f.attributes[ "id" ]... | ruby | def getFieldIDs(dbid = nil, exclude_built_in_fields = false )
fieldIDs = []
dbid ||= @dbid
getSchema(dbid)
if @fields
@fields.each_element_with_attribute( "id" ){|f|
next if exclude_built_in_fields and isBuiltInField?(f.attributes["id"])
fieldIDs << f.attributes[ "id" ]... | [
"def",
"getFieldIDs",
"(",
"dbid",
"=",
"nil",
",",
"exclude_built_in_fields",
"=",
"false",
")",
"fieldIDs",
"=",
"[",
"]",
"dbid",
"||=",
"@dbid",
"getSchema",
"(",
"dbid",
")",
"if",
"@fields",
"@fields",
".",
"each_element_with_attribute",
"(",
"\"id\"",
... | Get an array of field IDs for a table. | [
"Get",
"an",
"array",
"of",
"field",
"IDs",
"for",
"a",
"table",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L823-L834 |
4,101 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getFieldNames | def getFieldNames( dbid = nil, lowerOrUppercase = "", exclude_built_in_fields = false )
fieldNames = []
dbid ||= @dbid
getSchema(dbid)
if @fields
@fields.each_element_with_attribute( "id" ){ |f|
next if exclude_built_in_fields and isBuiltInField?(f.attributes["id"])
... | ruby | def getFieldNames( dbid = nil, lowerOrUppercase = "", exclude_built_in_fields = false )
fieldNames = []
dbid ||= @dbid
getSchema(dbid)
if @fields
@fields.each_element_with_attribute( "id" ){ |f|
next if exclude_built_in_fields and isBuiltInField?(f.attributes["id"])
... | [
"def",
"getFieldNames",
"(",
"dbid",
"=",
"nil",
",",
"lowerOrUppercase",
"=",
"\"\"",
",",
"exclude_built_in_fields",
"=",
"false",
")",
"fieldNames",
"=",
"[",
"]",
"dbid",
"||=",
"@dbid",
"getSchema",
"(",
"dbid",
")",
"if",
"@fields",
"@fields",
".",
"... | Get an array of field names for a table. | [
"Get",
"an",
"array",
"of",
"field",
"names",
"for",
"a",
"table",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L837-L856 |
4,102 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getApplicationVariables | def getApplicationVariables(dbid=nil)
variablesHash = {}
dbid ||= @dbid
qbc.getSchema(dbid)
if @variables
@variables.each_element_with_attribute( "name" ){ |var|
if var.name == "var" and var.has_text?
variablesHash[var.attributes["name"]] = var.text
... | ruby | def getApplicationVariables(dbid=nil)
variablesHash = {}
dbid ||= @dbid
qbc.getSchema(dbid)
if @variables
@variables.each_element_with_attribute( "name" ){ |var|
if var.name == "var" and var.has_text?
variablesHash[var.attributes["name"]] = var.text
... | [
"def",
"getApplicationVariables",
"(",
"dbid",
"=",
"nil",
")",
"variablesHash",
"=",
"{",
"}",
"dbid",
"||=",
"@dbid",
"qbc",
".",
"getSchema",
"(",
"dbid",
")",
"if",
"@variables",
"@variables",
".",
"each_element_with_attribute",
"(",
"\"name\"",
")",
"{",
... | Get a Hash of application variables. | [
"Get",
"a",
"Hash",
"of",
"application",
"variables",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L859-L871 |
4,103 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.lookupChdbid | def lookupChdbid( tableName, dbid=nil )
getSchema(dbid) if dbid
unmodifiedTableName = tableName.dup
@chdbid = findElementByAttributeValue( @chdbids, "name", formatChdbidName( tableName ) )
if @chdbid
@dbid = @chdbid.text
return @dbid
end
if @chdbids
... | ruby | def lookupChdbid( tableName, dbid=nil )
getSchema(dbid) if dbid
unmodifiedTableName = tableName.dup
@chdbid = findElementByAttributeValue( @chdbids, "name", formatChdbidName( tableName ) )
if @chdbid
@dbid = @chdbid.text
return @dbid
end
if @chdbids
... | [
"def",
"lookupChdbid",
"(",
"tableName",
",",
"dbid",
"=",
"nil",
")",
"getSchema",
"(",
"dbid",
")",
"if",
"dbid",
"unmodifiedTableName",
"=",
"tableName",
".",
"dup",
"@chdbid",
"=",
"findElementByAttributeValue",
"(",
"@chdbids",
",",
"\"name\"",
",",
"form... | Makes the table with the specified name the 'active' table, and returns the id from the table. | [
"Makes",
"the",
"table",
"with",
"the",
"specified",
"name",
"the",
"active",
"table",
"and",
"returns",
"the",
"id",
"from",
"the",
"table",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L914-L938 |
4,104 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getTableName | def getTableName(dbid)
tableName = nil
dbid ||= @dbid
if getSchema(dbid)
tableName = getResponseElement( "table/name" ).text
end
tableName
end | ruby | def getTableName(dbid)
tableName = nil
dbid ||= @dbid
if getSchema(dbid)
tableName = getResponseElement( "table/name" ).text
end
tableName
end | [
"def",
"getTableName",
"(",
"dbid",
")",
"tableName",
"=",
"nil",
"dbid",
"||=",
"@dbid",
"if",
"getSchema",
"(",
"dbid",
")",
"tableName",
"=",
"getResponseElement",
"(",
"\"table/name\"",
")",
".",
"text",
"end",
"tableName",
"end"
] | Get the name of a table given its id. | [
"Get",
"the",
"name",
"of",
"a",
"table",
"given",
"its",
"id",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L941-L948 |
4,105 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getTableNames | def getTableNames(dbid, lowercaseOrUpperCase = "")
tableNames = []
dbid ||= @dbid
getSchema(dbid)
if @chdbids
chdbidArray = findElementsByAttributeName( @chdbids, "name" )
chdbidArray.each{ |chdbid|
if chdbid.has_text?
dbid = chdbid.text... | ruby | def getTableNames(dbid, lowercaseOrUpperCase = "")
tableNames = []
dbid ||= @dbid
getSchema(dbid)
if @chdbids
chdbidArray = findElementsByAttributeName( @chdbids, "name" )
chdbidArray.each{ |chdbid|
if chdbid.has_text?
dbid = chdbid.text... | [
"def",
"getTableNames",
"(",
"dbid",
",",
"lowercaseOrUpperCase",
"=",
"\"\"",
")",
"tableNames",
"=",
"[",
"]",
"dbid",
"||=",
"@dbid",
"getSchema",
"(",
"dbid",
")",
"if",
"@chdbids",
"chdbidArray",
"=",
"findElementsByAttributeName",
"(",
"@chdbids",
",",
"... | Get a list of the names of the child tables of an application. | [
"Get",
"a",
"list",
"of",
"the",
"names",
"of",
"the",
"child",
"tables",
"of",
"an",
"application",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L951-L975 |
4,106 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getTableIDs | def getTableIDs(dbid)
tableIDs = []
dbid ||= @dbid
getSchema(dbid)
if @chdbids
chdbidArray = findElementsByAttributeName( @chdbids, "name" )
chdbidArray.each{ |chdbid|
if chdbid.has_text?
tableIDs << chdbid.text
end
... | ruby | def getTableIDs(dbid)
tableIDs = []
dbid ||= @dbid
getSchema(dbid)
if @chdbids
chdbidArray = findElementsByAttributeName( @chdbids, "name" )
chdbidArray.each{ |chdbid|
if chdbid.has_text?
tableIDs << chdbid.text
end
... | [
"def",
"getTableIDs",
"(",
"dbid",
")",
"tableIDs",
"=",
"[",
"]",
"dbid",
"||=",
"@dbid",
"getSchema",
"(",
"dbid",
")",
"if",
"@chdbids",
"chdbidArray",
"=",
"findElementsByAttributeName",
"(",
"@chdbids",
",",
"\"name\"",
")",
"chdbidArray",
".",
"each",
... | Get a list of the dbids of the child tables of an application. | [
"Get",
"a",
"list",
"of",
"the",
"dbids",
"of",
"the",
"child",
"tables",
"of",
"an",
"application",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L978-L991 |
4,107 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getNumTables | def getNumTables(dbid)
numTables = 0
dbid ||= @dbid
if getSchema(dbid)
if @chdbids
chdbidArray = findElementsByAttributeName( @chdbids, "name" )
numTables = chdbidArray.length
end
end
numTables
end | ruby | def getNumTables(dbid)
numTables = 0
dbid ||= @dbid
if getSchema(dbid)
if @chdbids
chdbidArray = findElementsByAttributeName( @chdbids, "name" )
numTables = chdbidArray.length
end
end
numTables
end | [
"def",
"getNumTables",
"(",
"dbid",
")",
"numTables",
"=",
"0",
"dbid",
"||=",
"@dbid",
"if",
"getSchema",
"(",
"dbid",
")",
"if",
"@chdbids",
"chdbidArray",
"=",
"findElementsByAttributeName",
"(",
"@chdbids",
",",
"\"name\"",
")",
"numTables",
"=",
"chdbidAr... | Get the number of child tables of an application | [
"Get",
"the",
"number",
"of",
"child",
"tables",
"of",
"an",
"application"
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L994-L1004 |
4,108 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getRealmForDbid | def getRealmForDbid(dbid)
@realm = nil
if USING_HTTPCLIENT
begin
httpclient = HTTPClient.new
resp = httpclient.get("https://www.quickbase.com/db/#{dbid}")
location = resp.header['Location'][0]
location.sub!("https://","")
parts = l... | ruby | def getRealmForDbid(dbid)
@realm = nil
if USING_HTTPCLIENT
begin
httpclient = HTTPClient.new
resp = httpclient.get("https://www.quickbase.com/db/#{dbid}")
location = resp.header['Location'][0]
location.sub!("https://","")
parts = l... | [
"def",
"getRealmForDbid",
"(",
"dbid",
")",
"@realm",
"=",
"nil",
"if",
"USING_HTTPCLIENT",
"begin",
"httpclient",
"=",
"HTTPClient",
".",
"new",
"resp",
"=",
"httpclient",
".",
"get",
"(",
"\"https://www.quickbase.com/db/#{dbid}\"",
")",
"location",
"=",
"resp",
... | Given a DBID, get the QuickBase realm it is in. | [
"Given",
"a",
"DBID",
"get",
"the",
"QuickBase",
"realm",
"it",
"is",
"in",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1024-L1041 |
4,109 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.isValidFieldType? | def isValidFieldType?( type )
@validFieldTypes ||= %w{ checkbox dblink date duration email file fkey float formula currency
lookup multiuserid phone percent rating recordid text timeofday timestamp url userid icalendarbutton }
@validFieldTypes.include?( type )
end | ruby | def isValidFieldType?( type )
@validFieldTypes ||= %w{ checkbox dblink date duration email file fkey float formula currency
lookup multiuserid phone percent rating recordid text timeofday timestamp url userid icalendarbutton }
@validFieldTypes.include?( type )
end | [
"def",
"isValidFieldType?",
"(",
"type",
")",
"@validFieldTypes",
"||=",
"%w{",
"checkbox",
"dblink",
"date",
"duration",
"email",
"file",
"fkey",
"float",
"formula",
"currency",
"lookup",
"multiuserid",
"phone",
"percent",
"rating",
"recordid",
"text",
"timeofday",... | Returns whether a given string represents a valid QuickBase field type. | [
"Returns",
"whether",
"a",
"given",
"string",
"represents",
"a",
"valid",
"QuickBase",
"field",
"type",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1054-L1058 |
4,110 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.isValidFieldProperty? | def isValidFieldProperty?( property )
if @validFieldProperties.nil?
@validFieldProperties = %w{ allow_new_choices allowHTML appears_by_default append_only
blank_is_zero bold carrychoices comma_start cover_text currency_format currency_symbol
decimal_places default_kind def... | ruby | def isValidFieldProperty?( property )
if @validFieldProperties.nil?
@validFieldProperties = %w{ allow_new_choices allowHTML appears_by_default append_only
blank_is_zero bold carrychoices comma_start cover_text currency_format currency_symbol
decimal_places default_kind def... | [
"def",
"isValidFieldProperty?",
"(",
"property",
")",
"if",
"@validFieldProperties",
".",
"nil?",
"@validFieldProperties",
"=",
"%w{",
"allow_new_choices",
"allowHTML",
"appears_by_default",
"append_only",
"blank_is_zero",
"bold",
"carrychoices",
"comma_start",
"cover_text",
... | Returns whether a given string represents a valid QuickBase field property. | [
"Returns",
"whether",
"a",
"given",
"string",
"represents",
"a",
"valid",
"QuickBase",
"field",
"property",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1067-L1079 |
4,111 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.verifyFieldList | def verifyFieldList( fnames, fids = nil, dbid = @dbid )
getSchema( dbid )
@fids = @fnames = nil
if fids
if fids.is_a?( Array ) and fids.length > 0
fids.each { |id|
fid = lookupField( id )
if fid
fname = lookupFieldNameFromID( i... | ruby | def verifyFieldList( fnames, fids = nil, dbid = @dbid )
getSchema( dbid )
@fids = @fnames = nil
if fids
if fids.is_a?( Array ) and fids.length > 0
fids.each { |id|
fid = lookupField( id )
if fid
fname = lookupFieldNameFromID( i... | [
"def",
"verifyFieldList",
"(",
"fnames",
",",
"fids",
"=",
"nil",
",",
"dbid",
"=",
"@dbid",
")",
"getSchema",
"(",
"dbid",
")",
"@fids",
"=",
"@fnames",
"=",
"nil",
"if",
"fids",
"if",
"fids",
".",
"is_a?",
"(",
"Array",
")",
"and",
"fids",
".",
"... | Given an array of field names or field IDs and a table ID, builds an array of valid field IDs and field names.
Throws an exception when an invalid name or ID is encountered. | [
"Given",
"an",
"array",
"of",
"field",
"names",
"or",
"field",
"IDs",
"and",
"a",
"table",
"ID",
"builds",
"an",
"array",
"of",
"valid",
"field",
"IDs",
"and",
"field",
"names",
".",
"Throws",
"an",
"exception",
"when",
"an",
"invalid",
"name",
"or",
"... | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1200-L1239 |
4,112 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getQueryRequestXML | def getQueryRequestXML( query = nil, qid = nil, qname = nil )
@query = @qid = @qname = nil
if query
@query = query == "" ? "{'0'.CT.''}" : query
xmlRequestData = toXML( :query, @query )
elsif qid
@qid = qid
xmlRequestData = toXML( :qid, @qid )
elsif qname
... | ruby | def getQueryRequestXML( query = nil, qid = nil, qname = nil )
@query = @qid = @qname = nil
if query
@query = query == "" ? "{'0'.CT.''}" : query
xmlRequestData = toXML( :query, @query )
elsif qid
@qid = qid
xmlRequestData = toXML( :qid, @qid )
elsif qname
... | [
"def",
"getQueryRequestXML",
"(",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
")",
"@query",
"=",
"@qid",
"=",
"@qname",
"=",
"nil",
"if",
"query",
"@query",
"=",
"query",
"==",
"\"\"",
"?",
"\"{'0'.CT.''}\"",
":",
"query",
... | Builds the request XML for retrieving the results of a query. | [
"Builds",
"the",
"request",
"XML",
"for",
"retrieving",
"the",
"results",
"of",
"a",
"query",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1242-L1258 |
4,113 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getColumnListForQuery | def getColumnListForQuery( id, name )
clistForQuery = nil
if id
query = lookupQuery( id )
elsif name
query = lookupQueryByName( name )
end
if query and query.elements["qyclst"]
clistForQuery = query.elements["qyclst"].text.dup
end
clistForQu... | ruby | def getColumnListForQuery( id, name )
clistForQuery = nil
if id
query = lookupQuery( id )
elsif name
query = lookupQueryByName( name )
end
if query and query.elements["qyclst"]
clistForQuery = query.elements["qyclst"].text.dup
end
clistForQu... | [
"def",
"getColumnListForQuery",
"(",
"id",
",",
"name",
")",
"clistForQuery",
"=",
"nil",
"if",
"id",
"query",
"=",
"lookupQuery",
"(",
"id",
")",
"elsif",
"name",
"query",
"=",
"lookupQueryByName",
"(",
"name",
")",
"end",
"if",
"query",
"and",
"query",
... | Returns the clist associated with a query. | [
"Returns",
"the",
"clist",
"associated",
"with",
"a",
"query",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1261-L1272 |
4,114 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getSortListForQuery | def getSortListForQuery( id, name )
slistForQuery = nil
if id
query = lookupQuery( id )
elsif name
query = lookupQueryByName( name )
end
if query and query.elements["qyslst"]
slistForQuery = query.elements["qyslst"].text.dup
end
slistForQuer... | ruby | def getSortListForQuery( id, name )
slistForQuery = nil
if id
query = lookupQuery( id )
elsif name
query = lookupQueryByName( name )
end
if query and query.elements["qyslst"]
slistForQuery = query.elements["qyslst"].text.dup
end
slistForQuer... | [
"def",
"getSortListForQuery",
"(",
"id",
",",
"name",
")",
"slistForQuery",
"=",
"nil",
"if",
"id",
"query",
"=",
"lookupQuery",
"(",
"id",
")",
"elsif",
"name",
"query",
"=",
"lookupQueryByName",
"(",
"name",
")",
"end",
"if",
"query",
"and",
"query",
"... | Returns the slist associated with a query. | [
"Returns",
"the",
"slist",
"associated",
"with",
"a",
"query",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1277-L1288 |
4,115 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getCriteriaForQuery | def getCriteriaForQuery( id, name )
criteriaForQuery = nil
if id
query = lookupQuery( id )
elsif name
query = lookupQueryByName( name )
end
if query and query.elements["qycrit"]
criteriaForQuery = query.elements["qycrit"].text.dup
end
criter... | ruby | def getCriteriaForQuery( id, name )
criteriaForQuery = nil
if id
query = lookupQuery( id )
elsif name
query = lookupQueryByName( name )
end
if query and query.elements["qycrit"]
criteriaForQuery = query.elements["qycrit"].text.dup
end
criter... | [
"def",
"getCriteriaForQuery",
"(",
"id",
",",
"name",
")",
"criteriaForQuery",
"=",
"nil",
"if",
"id",
"query",
"=",
"lookupQuery",
"(",
"id",
")",
"elsif",
"name",
"query",
"=",
"lookupQueryByName",
"(",
"name",
")",
"end",
"if",
"query",
"and",
"query",
... | Returns the criteria associated with a query. | [
"Returns",
"the",
"criteria",
"associated",
"with",
"a",
"query",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1293-L1304 |
4,116 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.verifyQueryOperator | def verifyQueryOperator( operator, fieldType )
queryOperator = ""
if @queryOperators.nil?
@queryOperators = {}
@queryOperatorFieldType = {}
@queryOperators[ "CT" ] = [ "contains", "[]" ]
@queryOperators[ "XCT" ] = [ "does not contain", "![]" ]
@que... | ruby | def verifyQueryOperator( operator, fieldType )
queryOperator = ""
if @queryOperators.nil?
@queryOperators = {}
@queryOperatorFieldType = {}
@queryOperators[ "CT" ] = [ "contains", "[]" ]
@queryOperators[ "XCT" ] = [ "does not contain", "![]" ]
@que... | [
"def",
"verifyQueryOperator",
"(",
"operator",
",",
"fieldType",
")",
"queryOperator",
"=",
"\"\"",
"if",
"@queryOperators",
".",
"nil?",
"@queryOperators",
"=",
"{",
"}",
"@queryOperatorFieldType",
"=",
"{",
"}",
"@queryOperators",
"[",
"\"CT\"",
"]",
"=",
"[",... | Returns a valid query operator. | [
"Returns",
"a",
"valid",
"query",
"operator",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1309-L1367 |
4,117 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.lookupBaseFieldTypeByName | def lookupBaseFieldTypeByName( fieldName )
type = ""
fid = lookupFieldIDByName( fieldName )
field = lookupField( fid ) if fid
type = field.attributes[ "base_type" ] if field
type
end | ruby | def lookupBaseFieldTypeByName( fieldName )
type = ""
fid = lookupFieldIDByName( fieldName )
field = lookupField( fid ) if fid
type = field.attributes[ "base_type" ] if field
type
end | [
"def",
"lookupBaseFieldTypeByName",
"(",
"fieldName",
")",
"type",
"=",
"\"\"",
"fid",
"=",
"lookupFieldIDByName",
"(",
"fieldName",
")",
"field",
"=",
"lookupField",
"(",
"fid",
")",
"if",
"fid",
"type",
"=",
"field",
".",
"attributes",
"[",
"\"base_type\"",
... | Get a field's base type using its name. | [
"Get",
"a",
"field",
"s",
"base",
"type",
"using",
"its",
"name",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1370-L1376 |
4,118 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.lookupFieldTypeByName | def lookupFieldTypeByName( fieldName )
type = ""
fid = lookupFieldIDByName( fieldName )
field = lookupField( fid ) if fid
type = field.attributes[ "field_type" ] if field
type
end | ruby | def lookupFieldTypeByName( fieldName )
type = ""
fid = lookupFieldIDByName( fieldName )
field = lookupField( fid ) if fid
type = field.attributes[ "field_type" ] if field
type
end | [
"def",
"lookupFieldTypeByName",
"(",
"fieldName",
")",
"type",
"=",
"\"\"",
"fid",
"=",
"lookupFieldIDByName",
"(",
"fieldName",
")",
"field",
"=",
"lookupField",
"(",
"fid",
")",
"if",
"fid",
"type",
"=",
"field",
".",
"attributes",
"[",
"\"field_type\"",
"... | Get a field's type using its name. | [
"Get",
"a",
"field",
"s",
"type",
"using",
"its",
"name",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1379-L1385 |
4,119 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.formatDate | def formatDate( milliseconds, fmtString = nil, addDay = false )
fmt = ""
fmtString = "%m-%d-%Y" if fmtString.nil?
if milliseconds
milliseconds_s = milliseconds.to_s
if milliseconds_s.length == 13
t = Time.at( milliseconds_s[0,10].to_i, milliseconds_s[10,3].to_i )
... | ruby | def formatDate( milliseconds, fmtString = nil, addDay = false )
fmt = ""
fmtString = "%m-%d-%Y" if fmtString.nil?
if milliseconds
milliseconds_s = milliseconds.to_s
if milliseconds_s.length == 13
t = Time.at( milliseconds_s[0,10].to_i, milliseconds_s[10,3].to_i )
... | [
"def",
"formatDate",
"(",
"milliseconds",
",",
"fmtString",
"=",
"nil",
",",
"addDay",
"=",
"false",
")",
"fmt",
"=",
"\"\"",
"fmtString",
"=",
"\"%m-%d-%Y\"",
"if",
"fmtString",
".",
"nil?",
"if",
"milliseconds",
"milliseconds_s",
"=",
"milliseconds",
".",
... | Returns the human-readable string represntation of a date, given the
milliseconds version of the date. Also needed for requests to QuickBase. | [
"Returns",
"the",
"human",
"-",
"readable",
"string",
"represntation",
"of",
"a",
"date",
"given",
"the",
"milliseconds",
"version",
"of",
"the",
"date",
".",
"Also",
"needed",
"for",
"requests",
"to",
"QuickBase",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1394-L1410 |
4,120 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.formatDuration | def formatDuration( value, option = "hours" )
option = "hours" if option.nil?
if value.nil?
value = ""
else
seconds = (value.to_i/1000)
minutes = (seconds/60)
hours = (minutes/60)
days = (hours/24)
if option == "days"
value... | ruby | def formatDuration( value, option = "hours" )
option = "hours" if option.nil?
if value.nil?
value = ""
else
seconds = (value.to_i/1000)
minutes = (seconds/60)
hours = (minutes/60)
days = (hours/24)
if option == "days"
value... | [
"def",
"formatDuration",
"(",
"value",
",",
"option",
"=",
"\"hours\"",
")",
"option",
"=",
"\"hours\"",
"if",
"option",
".",
"nil?",
"if",
"value",
".",
"nil?",
"value",
"=",
"\"\"",
"else",
"seconds",
"=",
"(",
"value",
".",
"to_i",
"/",
"1000",
")",... | Converts milliseconds to hours and returns the value as a string. | [
"Converts",
"milliseconds",
"to",
"hours",
"and",
"returns",
"the",
"value",
"as",
"a",
"string",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1413-L1431 |
4,121 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.formatTimeOfDay | def formatTimeOfDay(milliseconds, format = "%I:%M %p" )
format ||= "%I:%M %p"
timeOfDay = ""
timeOfDay = Time.at(milliseconds.to_i/1000).utc.strftime(format) if milliseconds
end | ruby | def formatTimeOfDay(milliseconds, format = "%I:%M %p" )
format ||= "%I:%M %p"
timeOfDay = ""
timeOfDay = Time.at(milliseconds.to_i/1000).utc.strftime(format) if milliseconds
end | [
"def",
"formatTimeOfDay",
"(",
"milliseconds",
",",
"format",
"=",
"\"%I:%M %p\"",
")",
"format",
"||=",
"\"%I:%M %p\"",
"timeOfDay",
"=",
"\"\"",
"timeOfDay",
"=",
"Time",
".",
"at",
"(",
"milliseconds",
".",
"to_i",
"/",
"1000",
")",
".",
"utc",
".",
"st... | Returns a string format for a time of day value. | [
"Returns",
"a",
"string",
"format",
"for",
"a",
"time",
"of",
"day",
"value",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1434-L1438 |
4,122 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.formatCurrency | def formatCurrency( value, options = nil )
value ||= "0.00"
if !value.include?( '.' )
value << ".00"
end
currencySymbol = currencyFormat = nil
if options
currencySymbol = options["currencySymbol"]
currencyFormat = options["currencyFormat"]
... | ruby | def formatCurrency( value, options = nil )
value ||= "0.00"
if !value.include?( '.' )
value << ".00"
end
currencySymbol = currencyFormat = nil
if options
currencySymbol = options["currencySymbol"]
currencyFormat = options["currencyFormat"]
... | [
"def",
"formatCurrency",
"(",
"value",
",",
"options",
"=",
"nil",
")",
"value",
"||=",
"\"0.00\"",
"if",
"!",
"value",
".",
"include?",
"(",
"'.'",
")",
"value",
"<<",
"\".00\"",
"end",
"currencySymbol",
"=",
"currencyFormat",
"=",
"nil",
"if",
"options",... | Returns a string formatted for a currency value. | [
"Returns",
"a",
"string",
"formatted",
"for",
"a",
"currency",
"value",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1441-L1474 |
4,123 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.formatPercent | def formatPercent( value, options = nil )
if value
percent = (value.to_f * 100)
value = percent.to_s
if value.include?(".")
int,fraction = value.split('.')
if fraction.to_i == 0
value = int
else
value = "#{int}.#... | ruby | def formatPercent( value, options = nil )
if value
percent = (value.to_f * 100)
value = percent.to_s
if value.include?(".")
int,fraction = value.split('.')
if fraction.to_i == 0
value = int
else
value = "#{int}.#... | [
"def",
"formatPercent",
"(",
"value",
",",
"options",
"=",
"nil",
")",
"if",
"value",
"percent",
"=",
"(",
"value",
".",
"to_f",
"*",
"100",
")",
"value",
"=",
"percent",
".",
"to_s",
"if",
"value",
".",
"include?",
"(",
"\".\"",
")",
"int",
",",
"... | Returns a string formatted for a percent value, given the data from QuickBase | [
"Returns",
"a",
"string",
"formatted",
"for",
"a",
"percent",
"value",
"given",
"the",
"data",
"from",
"QuickBase"
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1477-L1493 |
4,124 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.dateToMS | def dateToMS( dateString )
milliseconds = 0
if dateString and dateString.match( /[0-9][0-9]\-[0-9][0-9]\-[0-9][0-9][0-9][0-9]/)
d = Date.new( dateString[7,4], dateString[4,2], dateString[0,2] )
milliseconds = d.jd
end
milliseconds
end | ruby | def dateToMS( dateString )
milliseconds = 0
if dateString and dateString.match( /[0-9][0-9]\-[0-9][0-9]\-[0-9][0-9][0-9][0-9]/)
d = Date.new( dateString[7,4], dateString[4,2], dateString[0,2] )
milliseconds = d.jd
end
milliseconds
end | [
"def",
"dateToMS",
"(",
"dateString",
")",
"milliseconds",
"=",
"0",
"if",
"dateString",
"and",
"dateString",
".",
"match",
"(",
"/",
"\\-",
"\\-",
"/",
")",
"d",
"=",
"Date",
".",
"new",
"(",
"dateString",
"[",
"7",
",",
"4",
"]",
",",
"dateString",... | Returns the milliseconds representation of a date specified in mm-dd-yyyy format. | [
"Returns",
"the",
"milliseconds",
"representation",
"of",
"a",
"date",
"specified",
"in",
"mm",
"-",
"dd",
"-",
"yyyy",
"format",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1496-L1503 |
4,125 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.escapeXML | def escapeXML( char )
if @xmlEscapes.nil?
@xmlEscapes = {}
(0..255).each{ |i| @xmlEscapes[ i.chr ] = sprintf( "&#%03d;", i ) }
end
return @xmlEscapes[ char ] if @xmlEscapes[ char ]
char
end | ruby | def escapeXML( char )
if @xmlEscapes.nil?
@xmlEscapes = {}
(0..255).each{ |i| @xmlEscapes[ i.chr ] = sprintf( "&#%03d;", i ) }
end
return @xmlEscapes[ char ] if @xmlEscapes[ char ]
char
end | [
"def",
"escapeXML",
"(",
"char",
")",
"if",
"@xmlEscapes",
".",
"nil?",
"@xmlEscapes",
"=",
"{",
"}",
"(",
"0",
"..",
"255",
")",
".",
"each",
"{",
"|",
"i",
"|",
"@xmlEscapes",
"[",
"i",
".",
"chr",
"]",
"=",
"sprintf",
"(",
"\"&#%03d;\"",
",",
... | Returns the URL-encoded version of a non-printing character. | [
"Returns",
"the",
"URL",
"-",
"encoded",
"version",
"of",
"a",
"non",
"-",
"printing",
"character",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1512-L1519 |
4,126 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.encodingStrings | def encodingStrings( reverse = false )
@encodingStrings = [ {"&" => "&" }, {"<" => "<"} , {">" => ">"}, {"'" => "'"}, {"\"" => """ } ] if @encodingStrings.nil?
if block_given?
if reverse
@encodingStrings.reverse_each{ |s| s.each{|k,v| yield v,k } }
e... | ruby | def encodingStrings( reverse = false )
@encodingStrings = [ {"&" => "&" }, {"<" => "<"} , {">" => ">"}, {"'" => "'"}, {"\"" => """ } ] if @encodingStrings.nil?
if block_given?
if reverse
@encodingStrings.reverse_each{ |s| s.each{|k,v| yield v,k } }
e... | [
"def",
"encodingStrings",
"(",
"reverse",
"=",
"false",
")",
"@encodingStrings",
"=",
"[",
"{",
"\"&\"",
"=>",
"\"&\"",
"}",
",",
"{",
"\"<\"",
"=>",
"\"<\"",
"}",
",",
"{",
"\">\"",
"=>",
"\">\"",
"}",
",",
"{",
"\"'\"",
"=>",
"\"'\"",
... | Returns the list of string substitutions to make to encode or decode field values used in XML. | [
"Returns",
"the",
"list",
"of",
"string",
"substitutions",
"to",
"make",
"to",
"encode",
"or",
"decode",
"field",
"values",
"used",
"in",
"XML",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1522-L1533 |
4,127 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.encodeXML | def encodeXML( text, doNPChars = false )
encodingStrings { |key,value| text.gsub!( key, value ) if text }
text.gsub!( /([^;\/?:@&=+\$,A-Za-z0-9\-_.!~*'()# ])/ ) { |c| escapeXML( $1 ) } if text and doNPChars
text
end | ruby | def encodeXML( text, doNPChars = false )
encodingStrings { |key,value| text.gsub!( key, value ) if text }
text.gsub!( /([^;\/?:@&=+\$,A-Za-z0-9\-_.!~*'()# ])/ ) { |c| escapeXML( $1 ) } if text and doNPChars
text
end | [
"def",
"encodeXML",
"(",
"text",
",",
"doNPChars",
"=",
"false",
")",
"encodingStrings",
"{",
"|",
"key",
",",
"value",
"|",
"text",
".",
"gsub!",
"(",
"key",
",",
"value",
")",
"if",
"text",
"}",
"text",
".",
"gsub!",
"(",
"/",
"\\/",
"\\$",
"\\-"... | Modify the given string for use as a XML field value. | [
"Modify",
"the",
"given",
"string",
"for",
"use",
"as",
"a",
"XML",
"field",
"value",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1536-L1540 |
4,128 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.decodeXML | def decodeXML( text )
encodingStrings( true ) { |key,value| text.gsub!( value, key ) if text }
text.gsub!( /&#([0-9]{2,3});/ ) { |c| $1.chr } if text
text
end | ruby | def decodeXML( text )
encodingStrings( true ) { |key,value| text.gsub!( value, key ) if text }
text.gsub!( /&#([0-9]{2,3});/ ) { |c| $1.chr } if text
text
end | [
"def",
"decodeXML",
"(",
"text",
")",
"encodingStrings",
"(",
"true",
")",
"{",
"|",
"key",
",",
"value",
"|",
"text",
".",
"gsub!",
"(",
"value",
",",
"key",
")",
"if",
"text",
"}",
"text",
".",
"gsub!",
"(",
"/",
"/",
")",
"{",
"|",
"c",
"|",... | Modify the given XML field value for use as a string. | [
"Modify",
"the",
"given",
"XML",
"field",
"value",
"for",
"use",
"as",
"a",
"string",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1543-L1547 |
4,129 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.fire | def fire( event )
if @eventSubscribers and @eventSubscribers.include?( event )
handlers = @eventSubscribers[ event ]
if handlers
handlers.each{ |handler| handler.handle( event ) }
end
end
end | ruby | def fire( event )
if @eventSubscribers and @eventSubscribers.include?( event )
handlers = @eventSubscribers[ event ]
if handlers
handlers.each{ |handler| handler.handle( event ) }
end
end
end | [
"def",
"fire",
"(",
"event",
")",
"if",
"@eventSubscribers",
"and",
"@eventSubscribers",
".",
"include?",
"(",
"event",
")",
"handlers",
"=",
"@eventSubscribers",
"[",
"event",
"]",
"if",
"handlers",
"handlers",
".",
"each",
"{",
"|",
"handler",
"|",
"handle... | Called by client methods to notify event subscribers | [
"Called",
"by",
"client",
"methods",
"to",
"notify",
"event",
"subscribers"
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1594-L1601 |
4,130 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client._addRecord | def _addRecord( fvlist = nil, disprec = nil, fform = nil, ignoreError = nil, update_id = nil )
addRecord( @dbid, fvlist, disprec, fform, ignoreError, update_id )
end | ruby | def _addRecord( fvlist = nil, disprec = nil, fform = nil, ignoreError = nil, update_id = nil )
addRecord( @dbid, fvlist, disprec, fform, ignoreError, update_id )
end | [
"def",
"_addRecord",
"(",
"fvlist",
"=",
"nil",
",",
"disprec",
"=",
"nil",
",",
"fform",
"=",
"nil",
",",
"ignoreError",
"=",
"nil",
",",
"update_id",
"=",
"nil",
")",
"addRecord",
"(",
"@dbid",
",",
"fvlist",
",",
"disprec",
",",
"fform",
",",
"ign... | API_AddRecord, using the active table id. | [
"API_AddRecord",
"using",
"the",
"active",
"table",
"id",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L1710-L1712 |
4,131 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client._doQueryHash | def _doQueryHash( doQueryOptions )
doQueryOptions ||= {}
raise "options must be a Hash" unless doQueryOptions.is_a?(Hash)
doQueryOptions["dbid"] ||= @dbid
doQueryOptions["fmt"] ||= "structured"
doQuery( doQueryOptions["dbid"],
doQueryOptions["query"],
... | ruby | def _doQueryHash( doQueryOptions )
doQueryOptions ||= {}
raise "options must be a Hash" unless doQueryOptions.is_a?(Hash)
doQueryOptions["dbid"] ||= @dbid
doQueryOptions["fmt"] ||= "structured"
doQuery( doQueryOptions["dbid"],
doQueryOptions["query"],
... | [
"def",
"_doQueryHash",
"(",
"doQueryOptions",
")",
"doQueryOptions",
"||=",
"{",
"}",
"raise",
"\"options must be a Hash\"",
"unless",
"doQueryOptions",
".",
"is_a?",
"(",
"Hash",
")",
"doQueryOptions",
"[",
"\"dbid\"",
"]",
"||=",
"@dbid",
"doQueryOptions",
"[",
... | version of doQuery that takes a Hash of parameters | [
"version",
"of",
"doQuery",
"that",
"takes",
"a",
"Hash",
"of",
"parameters"
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L2129-L2142 |
4,132 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.downLoadFile | def downLoadFile( dbid, rid, fid, vid = "0" )
@dbid, @rid, @fid, @vid = dbid, rid, fid, vid
@downLoadFileURL = "http://#{@org}.#{@domain}.com/up/#{dbid}/a/r#{rid}/e#{fid}/v#{vid}"
if @useSSL
@downLoadFileURL.gsub!( "http:", "https:" )
end
@requestHeaders = { "C... | ruby | def downLoadFile( dbid, rid, fid, vid = "0" )
@dbid, @rid, @fid, @vid = dbid, rid, fid, vid
@downLoadFileURL = "http://#{@org}.#{@domain}.com/up/#{dbid}/a/r#{rid}/e#{fid}/v#{vid}"
if @useSSL
@downLoadFileURL.gsub!( "http:", "https:" )
end
@requestHeaders = { "C... | [
"def",
"downLoadFile",
"(",
"dbid",
",",
"rid",
",",
"fid",
",",
"vid",
"=",
"\"0\"",
")",
"@dbid",
",",
"@rid",
",",
"@fid",
",",
"@vid",
"=",
"dbid",
",",
"rid",
",",
"fid",
",",
"vid",
"@downLoadFileURL",
"=",
"\"http://#{@org}.#{@domain}.com/up/#{dbid}... | Download a file's contents from a file attachment field in QuickBase.
You must write the contents to disk before a local file exists. | [
"Download",
"a",
"file",
"s",
"contents",
"from",
"a",
"file",
"attachment",
"field",
"in",
"QuickBase",
".",
"You",
"must",
"write",
"the",
"contents",
"to",
"disk",
"before",
"a",
"local",
"file",
"exists",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L2163-L2206 |
4,133 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.downloadAndSaveFile | def downloadAndSaveFile( dbid, rid, fid, filename = nil, vid = "0" )
response, fileContents = downLoadFile( dbid, rid, fid, vid )
if fileContents and fileContents.length > 0
if filename and filename.length > 0
Misc.save_file( filename, fileContents )
else
rec... | ruby | def downloadAndSaveFile( dbid, rid, fid, filename = nil, vid = "0" )
response, fileContents = downLoadFile( dbid, rid, fid, vid )
if fileContents and fileContents.length > 0
if filename and filename.length > 0
Misc.save_file( filename, fileContents )
else
rec... | [
"def",
"downloadAndSaveFile",
"(",
"dbid",
",",
"rid",
",",
"fid",
",",
"filename",
"=",
"nil",
",",
"vid",
"=",
"\"0\"",
")",
"response",
",",
"fileContents",
"=",
"downLoadFile",
"(",
"dbid",
",",
"rid",
",",
"fid",
",",
"vid",
")",
"if",
"fileConten... | Download and save a file from a file attachment field in QuickBase.
Use the filename parameter to override the file name from QuickBase. | [
"Download",
"and",
"save",
"a",
"file",
"from",
"a",
"file",
"attachment",
"field",
"in",
"QuickBase",
".",
"Use",
"the",
"filename",
"parameter",
"to",
"override",
"the",
"file",
"name",
"from",
"QuickBase",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L2218-L2232 |
4,134 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.fieldAddChoices | def fieldAddChoices( dbid, fid, choice )
@dbid, @fid, @choice = dbid, fid, choice
xmlRequestData = toXML( :fid, @fid )
if @choice.is_a?( Array )
@choice.each { |c| xmlRequestData << toXML( :choice, c ) }
elsif @choice.is_a?( String )
xmlRequestData << toXML( :choice... | ruby | def fieldAddChoices( dbid, fid, choice )
@dbid, @fid, @choice = dbid, fid, choice
xmlRequestData = toXML( :fid, @fid )
if @choice.is_a?( Array )
@choice.each { |c| xmlRequestData << toXML( :choice, c ) }
elsif @choice.is_a?( String )
xmlRequestData << toXML( :choice... | [
"def",
"fieldAddChoices",
"(",
"dbid",
",",
"fid",
",",
"choice",
")",
"@dbid",
",",
"@fid",
",",
"@choice",
"=",
"dbid",
",",
"fid",
",",
"choice",
"xmlRequestData",
"=",
"toXML",
"(",
":fid",
",",
"@fid",
")",
"if",
"@choice",
".",
"is_a?",
"(",
"A... | API_FieldAddChoices
The choice parameter can be one choice string or an array of choice strings. | [
"API_FieldAddChoices",
"The",
"choice",
"parameter",
"can",
"be",
"one",
"choice",
"string",
"or",
"an",
"array",
"of",
"choice",
"strings",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L2263-L2283 |
4,135 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.iterateDBPages | def iterateDBPages(dbid)
listDBPages(dbid){|page|
if page.is_a?( REXML::Element) and page.name == "page"
@pageid = page.attributes["id"]
@pagetype = page.attributes["type"]
@pagename = page.text if page.has_text?
@page = { "name... | ruby | def iterateDBPages(dbid)
listDBPages(dbid){|page|
if page.is_a?( REXML::Element) and page.name == "page"
@pageid = page.attributes["id"]
@pagetype = page.attributes["type"]
@pagename = page.text if page.has_text?
@page = { "name... | [
"def",
"iterateDBPages",
"(",
"dbid",
")",
"listDBPages",
"(",
"dbid",
")",
"{",
"|",
"page",
"|",
"if",
"page",
".",
"is_a?",
"(",
"REXML",
"::",
"Element",
")",
"and",
"page",
".",
"name",
"==",
"\"page\"",
"@pageid",
"=",
"page",
".",
"attributes",
... | Loop through the list of Pages for an application | [
"Loop",
"through",
"the",
"list",
"of",
"Pages",
"for",
"an",
"application"
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L3128-L3138 |
4,136 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getAllValuesForFields | def getAllValuesForFields( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
if dbid
getSchema(dbid)
values = {}
fieldIDs = {}
if fieldNames and fieldNames.is_a?( String )
va... | ruby | def getAllValuesForFields( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
if dbid
getSchema(dbid)
values = {}
fieldIDs = {}
if fieldNames and fieldNames.is_a?( String )
va... | [
"def",
"getAllValuesForFields",
"(",
"dbid",
",",
"fieldNames",
"=",
"nil",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
",",
"clist",
"=",
"nil",
",",
"slist",
"=",
"nil",
",",
"fmt",
"=",
"\"structured\"",
",",
"optio... | Get all the values for one or more fields from a specified table.
e.g. getAllValuesForFields( "dhnju5y7", [ "Name", "Phone" ] )
The results are returned in Hash, e.g. { "Name" => values[ "Name" ], "Phone" => values[ "Phone" ] }
The parameters after 'fieldNames' are passed directly to the doQuery() API_ call.
In... | [
"Get",
"all",
"the",
"values",
"for",
"one",
"or",
"more",
"fields",
"from",
"a",
"specified",
"table",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L3339-L3413 |
4,137 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getAllValuesForFieldsAsArray | def getAllValuesForFieldsAsArray( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
ret = []
valuesForFields = getAllValuesForFields(dbid, fieldNames, query, qid, qname, clist, slist,fmt,options)
if valuesForFields
f... | ruby | def getAllValuesForFieldsAsArray( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
ret = []
valuesForFields = getAllValuesForFields(dbid, fieldNames, query, qid, qname, clist, slist,fmt,options)
if valuesForFields
f... | [
"def",
"getAllValuesForFieldsAsArray",
"(",
"dbid",
",",
"fieldNames",
"=",
"nil",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
",",
"clist",
"=",
"nil",
",",
"slist",
"=",
"nil",
",",
"fmt",
"=",
"\"structured\"",
",",
... | Get all the values for one or more fields from a specified table.
This also formats the field values instead of returning the raw value. | [
"Get",
"all",
"the",
"values",
"for",
"one",
"or",
"more",
"fields",
"from",
"a",
"specified",
"table",
".",
"This",
"also",
"formats",
"the",
"field",
"values",
"instead",
"of",
"returning",
"the",
"raw",
"value",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L3419-L3437 |
4,138 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getAllValuesForFieldsAsJSON | def getAllValuesForFieldsAsJSON( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
ret = getAllValuesForFieldsAsArray(dbid,fieldNames,query,qid,qname,clist,slist,fmt,options)
ret = JSON.generate(ret) if ret
end | ruby | def getAllValuesForFieldsAsJSON( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
ret = getAllValuesForFieldsAsArray(dbid,fieldNames,query,qid,qname,clist,slist,fmt,options)
ret = JSON.generate(ret) if ret
end | [
"def",
"getAllValuesForFieldsAsJSON",
"(",
"dbid",
",",
"fieldNames",
"=",
"nil",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
",",
"clist",
"=",
"nil",
",",
"slist",
"=",
"nil",
",",
"fmt",
"=",
"\"structured\"",
",",
... | Get all the values for one or more fields from a specified table, in JSON format.
This formats the field values instead of returning raw values. | [
"Get",
"all",
"the",
"values",
"for",
"one",
"or",
"more",
"fields",
"from",
"a",
"specified",
"table",
"in",
"JSON",
"format",
".",
"This",
"formats",
"the",
"field",
"values",
"instead",
"of",
"returning",
"raw",
"values",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L3443-L3446 |
4,139 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getAllValuesForFieldsAsPrettyJSON | def getAllValuesForFieldsAsPrettyJSON( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
ret = getAllValuesForFieldsAsArray(dbid,fieldNames,query,qid,qname,clist,slist,fmt,options)
ret = JSON.pretty_generate(ret) if ret
end | ruby | def getAllValuesForFieldsAsPrettyJSON( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
ret = getAllValuesForFieldsAsArray(dbid,fieldNames,query,qid,qname,clist,slist,fmt,options)
ret = JSON.pretty_generate(ret) if ret
end | [
"def",
"getAllValuesForFieldsAsPrettyJSON",
"(",
"dbid",
",",
"fieldNames",
"=",
"nil",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
",",
"clist",
"=",
"nil",
",",
"slist",
"=",
"nil",
",",
"fmt",
"=",
"\"structured\"",
"... | Get all the values for one or more fields from a specified table, in human-readable JSON format.
This formats the field values instead of returning raw values. | [
"Get",
"all",
"the",
"values",
"for",
"one",
"or",
"more",
"fields",
"from",
"a",
"specified",
"table",
"in",
"human",
"-",
"readable",
"JSON",
"format",
".",
"This",
"formats",
"the",
"field",
"values",
"instead",
"of",
"returning",
"raw",
"values",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L3452-L3455 |
4,140 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getSummaryRecords | def getSummaryRecords( dbid, fieldNames,query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
summaryRecords = []
iterateSummaryRecords(dbid, fieldNames,query, qid, qname, clist, slist, fmt = "structured", options){|summaryRecord|
summaryRecords << su... | ruby | def getSummaryRecords( dbid, fieldNames,query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
summaryRecords = []
iterateSummaryRecords(dbid, fieldNames,query, qid, qname, clist, slist, fmt = "structured", options){|summaryRecord|
summaryRecords << su... | [
"def",
"getSummaryRecords",
"(",
"dbid",
",",
"fieldNames",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
",",
"clist",
"=",
"nil",
",",
"slist",
"=",
"nil",
",",
"fmt",
"=",
"\"structured\"",
",",
"options",
"=",
"nil",... | Collect summary records into an array. | [
"Collect",
"summary",
"records",
"into",
"an",
"array",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L3836-L3842 |
4,141 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.iterateRecordInfos | def iterateRecordInfos(dbid, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil)
getSchema(dbid)
recordIDFieldName = lookupFieldNameFromID("3")
fieldNames = getFieldNames
fieldIDs = {}
fieldNames.each{|name|fieldIDs[name] = lookupFieldIDBy... | ruby | def iterateRecordInfos(dbid, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil)
getSchema(dbid)
recordIDFieldName = lookupFieldNameFromID("3")
fieldNames = getFieldNames
fieldIDs = {}
fieldNames.each{|name|fieldIDs[name] = lookupFieldIDBy... | [
"def",
"iterateRecordInfos",
"(",
"dbid",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
",",
"clist",
"=",
"nil",
",",
"slist",
"=",
"nil",
",",
"fmt",
"=",
"\"structured\"",
",",
"options",
"=",
"nil",
")",
"getSchema",... | Loop through a list of records returned from a query.
Each record will contain all the fields with values formatted for readability by QuickBase via API_GetRecordInfo. | [
"Loop",
"through",
"a",
"list",
"of",
"records",
"returned",
"from",
"a",
"query",
".",
"Each",
"record",
"will",
"contain",
"all",
"the",
"fields",
"with",
"values",
"formatted",
"for",
"readability",
"by",
"QuickBase",
"via",
"API_GetRecordInfo",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L3846-L3861 |
4,142 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.applyPercentToRecords | def applyPercentToRecords( dbid, numericField, percentField,
query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil)
fieldNames = Array[numericField]
total = sum( dbid, fieldNames, query, qid, qname, clist, slist, fm... | ruby | def applyPercentToRecords( dbid, numericField, percentField,
query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil)
fieldNames = Array[numericField]
total = sum( dbid, fieldNames, query, qid, qname, clist, slist, fm... | [
"def",
"applyPercentToRecords",
"(",
"dbid",
",",
"numericField",
",",
"percentField",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
",",
"clist",
"=",
"nil",
",",
"slist",
"=",
"nil",
",",
"fmt",
"=",
"\"structured\"",
",... | Query records, sum the values in a numeric field, calculate each record's percentage
of the sum and put the percent in a percent field each record. | [
"Query",
"records",
"sum",
"the",
"values",
"in",
"a",
"numeric",
"field",
"calculate",
"each",
"record",
"s",
"percentage",
"of",
"the",
"sum",
"and",
"put",
"the",
"percent",
"in",
"a",
"percent",
"field",
"each",
"record",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4105-L4116 |
4,143 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.applyDeviationToRecords | def applyDeviationToRecords( dbid, numericField, deviationField,
query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil)
fieldNames = Array[numericField]
avg = average( dbid, fieldNames, query, qid, qname, clist, ... | ruby | def applyDeviationToRecords( dbid, numericField, deviationField,
query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil)
fieldNames = Array[numericField]
avg = average( dbid, fieldNames, query, qid, qname, clist, ... | [
"def",
"applyDeviationToRecords",
"(",
"dbid",
",",
"numericField",
",",
"deviationField",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
",",
"clist",
"=",
"nil",
",",
"slist",
"=",
"nil",
",",
"fmt",
"=",
"\"structured\"",
... | Query records, get the average of the values in a numeric field, calculate each record's deviation
from the average and put the deviation in a percent field each record. | [
"Query",
"records",
"get",
"the",
"average",
"of",
"the",
"values",
"in",
"a",
"numeric",
"field",
"calculate",
"each",
"record",
"s",
"deviation",
"from",
"the",
"average",
"and",
"put",
"the",
"deviation",
"in",
"a",
"percent",
"field",
"each",
"record",
... | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4120-L4131 |
4,144 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.percent | def percent( inputValues )
raise "'inputValues' must not be nil" if inputValues.nil?
raise "'inputValues' must be an Array" if not inputValues.is_a?(Array)
raise "'inputValues' must have at least two elements" if inputValues.length < 2
total = inputValues[0].to_f
total = 1.0 if total ... | ruby | def percent( inputValues )
raise "'inputValues' must not be nil" if inputValues.nil?
raise "'inputValues' must be an Array" if not inputValues.is_a?(Array)
raise "'inputValues' must have at least two elements" if inputValues.length < 2
total = inputValues[0].to_f
total = 1.0 if total ... | [
"def",
"percent",
"(",
"inputValues",
")",
"raise",
"\"'inputValues' must not be nil\"",
"if",
"inputValues",
".",
"nil?",
"raise",
"\"'inputValues' must be an Array\"",
"if",
"not",
"inputValues",
".",
"is_a?",
"(",
"Array",
")",
"raise",
"\"'inputValues' must have at le... | Given an array of two numbers, return the second number as a percentage of the first number. | [
"Given",
"an",
"array",
"of",
"two",
"numbers",
"return",
"the",
"second",
"number",
"as",
"a",
"percentage",
"of",
"the",
"first",
"number",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4134-L4142 |
4,145 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.deviation | def deviation( inputValues )
raise "'inputValues' must not be nil" if inputValues.nil?
raise "'inputValues' must be an Array" if not inputValues.is_a?(Array)
raise "'inputValues' must have at least two elements" if inputValues.length < 2
value = inputValues[0].to_f - inputValues[1].to_f
... | ruby | def deviation( inputValues )
raise "'inputValues' must not be nil" if inputValues.nil?
raise "'inputValues' must be an Array" if not inputValues.is_a?(Array)
raise "'inputValues' must have at least two elements" if inputValues.length < 2
value = inputValues[0].to_f - inputValues[1].to_f
... | [
"def",
"deviation",
"(",
"inputValues",
")",
"raise",
"\"'inputValues' must not be nil\"",
"if",
"inputValues",
".",
"nil?",
"raise",
"\"'inputValues' must be an Array\"",
"if",
"not",
"inputValues",
".",
"is_a?",
"(",
"Array",
")",
"raise",
"\"'inputValues' must have at ... | Given an array of two numbers, return the difference between the numbers as a positive number. | [
"Given",
"an",
"array",
"of",
"two",
"numbers",
"return",
"the",
"difference",
"between",
"the",
"numbers",
"as",
"a",
"positive",
"number",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4145-L4151 |
4,146 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getFieldChoices | def getFieldChoices(dbid,fieldName=nil,fid=nil)
getSchema(dbid)
if fieldName
fid = lookupFieldIDByName(fieldName)
elsif not fid
raise "'fieldName' or 'fid' must be specified"
end
field = lookupField( fid )
if field
choices = []
choicesPro... | ruby | def getFieldChoices(dbid,fieldName=nil,fid=nil)
getSchema(dbid)
if fieldName
fid = lookupFieldIDByName(fieldName)
elsif not fid
raise "'fieldName' or 'fid' must be specified"
end
field = lookupField( fid )
if field
choices = []
choicesPro... | [
"def",
"getFieldChoices",
"(",
"dbid",
",",
"fieldName",
"=",
"nil",
",",
"fid",
"=",
"nil",
")",
"getSchema",
"(",
"dbid",
")",
"if",
"fieldName",
"fid",
"=",
"lookupFieldIDByName",
"(",
"fieldName",
")",
"elsif",
"not",
"fid",
"raise",
"\"'fieldName' or 'f... | Get an array of the existing choices for a multiple-choice text field. | [
"Get",
"an",
"array",
"of",
"the",
"existing",
"choices",
"for",
"a",
"multiple",
"-",
"choice",
"text",
"field",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4154-L4177 |
4,147 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.deleteDuplicateRecords | def deleteDuplicateRecords( fnames, fids = nil, options = nil, dbid = @dbid )
num_deleted = 0
if options and not options.is_a?( Hash )
raise "deleteDuplicateRecords: 'options' parameter must be a Hash"
else
options = {}
options[ "keeplastrecord" ] = true
opt... | ruby | def deleteDuplicateRecords( fnames, fids = nil, options = nil, dbid = @dbid )
num_deleted = 0
if options and not options.is_a?( Hash )
raise "deleteDuplicateRecords: 'options' parameter must be a Hash"
else
options = {}
options[ "keeplastrecord" ] = true
opt... | [
"def",
"deleteDuplicateRecords",
"(",
"fnames",
",",
"fids",
"=",
"nil",
",",
"options",
"=",
"nil",
",",
"dbid",
"=",
"@dbid",
")",
"num_deleted",
"=",
"0",
"if",
"options",
"and",
"not",
"options",
".",
"is_a?",
"(",
"Hash",
")",
"raise",
"\"deleteDupl... | Finds records with the same values in a specified
list of fields and deletes all but the first or last duplicate record.
The field list may be a list of field IDs or a list of field names.
The 'options' parameter can be used to keep the oldest record instead of the
newest record, and to control whether to ignore th... | [
"Finds",
"records",
"with",
"the",
"same",
"values",
"in",
"a",
"specified",
"list",
"of",
"fields",
"and",
"deletes",
"all",
"but",
"the",
"first",
"or",
"last",
"duplicate",
"record",
".",
"The",
"field",
"list",
"may",
"be",
"a",
"list",
"of",
"field"... | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4257-L4274 |
4,148 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.copyRecord | def copyRecord( rid, numCopies = 1, dbid = @dbid )
clearFieldValuePairList
getRecordInfo( dbid, rid ) { |field|
if field and field.elements[ "value" ] and field.elements[ "value" ].has_text?
if field.elements[ "fid" ].text.to_i > 5 #skip built-in fields
addFieldValu... | ruby | def copyRecord( rid, numCopies = 1, dbid = @dbid )
clearFieldValuePairList
getRecordInfo( dbid, rid ) { |field|
if field and field.elements[ "value" ] and field.elements[ "value" ].has_text?
if field.elements[ "fid" ].text.to_i > 5 #skip built-in fields
addFieldValu... | [
"def",
"copyRecord",
"(",
"rid",
",",
"numCopies",
"=",
"1",
",",
"dbid",
"=",
"@dbid",
")",
"clearFieldValuePairList",
"getRecordInfo",
"(",
"dbid",
",",
"rid",
")",
"{",
"|",
"field",
"|",
"if",
"field",
"and",
"field",
".",
"elements",
"[",
"\"value\"... | Make one or more copies of a record. | [
"Make",
"one",
"or",
"more",
"copies",
"of",
"a",
"record",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4277-L4298 |
4,149 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client._importFromExcel | def _importFromExcel(excelFilename,lastColumn = 'j',lastDataRow = 0,worksheetNumber = 1,fieldNameRow = 1,firstDataRow = 2,firstColumn = 'a')
importFromExcel( @dbid, excelFilename, lastColumn, lastDataRow, worksheetNumber, fieldNameRow, firstDataRow, firstColumn )
end | ruby | def _importFromExcel(excelFilename,lastColumn = 'j',lastDataRow = 0,worksheetNumber = 1,fieldNameRow = 1,firstDataRow = 2,firstColumn = 'a')
importFromExcel( @dbid, excelFilename, lastColumn, lastDataRow, worksheetNumber, fieldNameRow, firstDataRow, firstColumn )
end | [
"def",
"_importFromExcel",
"(",
"excelFilename",
",",
"lastColumn",
"=",
"'j'",
",",
"lastDataRow",
"=",
"0",
",",
"worksheetNumber",
"=",
"1",
",",
"fieldNameRow",
"=",
"1",
",",
"firstDataRow",
"=",
"2",
",",
"firstColumn",
"=",
"'a'",
")",
"importFromExce... | Import data directly from an Excel file into the active table. | [
"Import",
"data",
"directly",
"from",
"an",
"Excel",
"file",
"into",
"the",
"active",
"table",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4380-L4382 |
4,150 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.importCSVFile | def importCSVFile( filename, dbid = @dbid, targetFieldNames = nil, validateLines = true )
importSVFile( filename, ",", dbid, targetFieldNames, validateLines )
end | ruby | def importCSVFile( filename, dbid = @dbid, targetFieldNames = nil, validateLines = true )
importSVFile( filename, ",", dbid, targetFieldNames, validateLines )
end | [
"def",
"importCSVFile",
"(",
"filename",
",",
"dbid",
"=",
"@dbid",
",",
"targetFieldNames",
"=",
"nil",
",",
"validateLines",
"=",
"true",
")",
"importSVFile",
"(",
"filename",
",",
"\",\"",
",",
"dbid",
",",
"targetFieldNames",
",",
"validateLines",
")",
"... | Add records from lines in a CSV file.
If dbid is not specified, the active table will be used.
values in subsequent lines. The file must not contain commas inside field names or values. | [
"Add",
"records",
"from",
"lines",
"in",
"a",
"CSV",
"file",
".",
"If",
"dbid",
"is",
"not",
"specified",
"the",
"active",
"table",
"will",
"be",
"used",
".",
"values",
"in",
"subsequent",
"lines",
".",
"The",
"file",
"must",
"not",
"contain",
"commas",
... | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4387-L4389 |
4,151 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.importTSVFile | def importTSVFile( filename, dbid = @dbid, targetFieldNames = nil, validateLines = true )
importSVFile( filename, "\t", dbid, targetFieldNames, validateLines )
end | ruby | def importTSVFile( filename, dbid = @dbid, targetFieldNames = nil, validateLines = true )
importSVFile( filename, "\t", dbid, targetFieldNames, validateLines )
end | [
"def",
"importTSVFile",
"(",
"filename",
",",
"dbid",
"=",
"@dbid",
",",
"targetFieldNames",
"=",
"nil",
",",
"validateLines",
"=",
"true",
")",
"importSVFile",
"(",
"filename",
",",
"\"\\t\"",
",",
"dbid",
",",
"targetFieldNames",
",",
"validateLines",
")",
... | Import records from a text file in Tab-Separated-Values format. | [
"Import",
"records",
"from",
"a",
"text",
"file",
"in",
"Tab",
"-",
"Separated",
"-",
"Values",
"format",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4392-L4394 |
4,152 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.makeSVFile | def makeSVFile( filename, fieldSeparator = ",", dbid = @dbid, query = nil, qid = nil, qname = nil )
File.open( filename, "w" ) { |file|
if dbid
doQuery( dbid, query, qid, qname )
end
if @records and @fields
# ------------- write field names on first l... | ruby | def makeSVFile( filename, fieldSeparator = ",", dbid = @dbid, query = nil, qid = nil, qname = nil )
File.open( filename, "w" ) { |file|
if dbid
doQuery( dbid, query, qid, qname )
end
if @records and @fields
# ------------- write field names on first l... | [
"def",
"makeSVFile",
"(",
"filename",
",",
"fieldSeparator",
"=",
"\",\"",
",",
"dbid",
"=",
"@dbid",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
")",
"File",
".",
"open",
"(",
"filename",
",",
"\"w\"",
")",
"{",
"|"... | Make a CSV file using the results of a query.
Specify a different separator in the second paramater.
Fields containing the separator will be double-quoted.
e.g. makeSVFile( "contacts.txt", "\t", nil )
e.g. makeSVFile( "contacts.txt", ",", "dhnju5y7", nil, nil, "List Changes" ) | [
"Make",
"a",
"CSV",
"file",
"using",
"the",
"results",
"of",
"a",
"query",
".",
"Specify",
"a",
"different",
"separator",
"in",
"the",
"second",
"paramater",
".",
"Fields",
"containing",
"the",
"separator",
"will",
"be",
"double",
"-",
"quoted",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4489-L4544 |
4,153 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.makeCSVFileForReport | def makeCSVFileForReport(filename,dbid=@dbid,query=nil,qid=nil,qname=nil)
csv = getCSVForReport(dbid,query,qid,qname)
File.open(filename,"w"){|f|f.write(csv || "")}
end | ruby | def makeCSVFileForReport(filename,dbid=@dbid,query=nil,qid=nil,qname=nil)
csv = getCSVForReport(dbid,query,qid,qname)
File.open(filename,"w"){|f|f.write(csv || "")}
end | [
"def",
"makeCSVFileForReport",
"(",
"filename",
",",
"dbid",
"=",
"@dbid",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
")",
"csv",
"=",
"getCSVForReport",
"(",
"dbid",
",",
"query",
",",
"qid",
",",
"qname",
")",
"File... | Create a CSV file using the records for a Report. | [
"Create",
"a",
"CSV",
"file",
"using",
"the",
"records",
"for",
"a",
"Report",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4547-L4550 |
4,154 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.getCSVForReport | def getCSVForReport(dbid,query=nil,qid=nil,qname=nil)
genResultsTable(dbid,query,nil,nil,nil,nil,"csv",qid,qname)
end | ruby | def getCSVForReport(dbid,query=nil,qid=nil,qname=nil)
genResultsTable(dbid,query,nil,nil,nil,nil,"csv",qid,qname)
end | [
"def",
"getCSVForReport",
"(",
"dbid",
",",
"query",
"=",
"nil",
",",
"qid",
"=",
"nil",
",",
"qname",
"=",
"nil",
")",
"genResultsTable",
"(",
"dbid",
",",
"query",
",",
"nil",
",",
"nil",
",",
"nil",
",",
"nil",
",",
"\"csv\"",
",",
"qid",
",",
... | Get the CSV data for a Report. | [
"Get",
"the",
"CSV",
"data",
"for",
"a",
"Report",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4553-L4555 |
4,155 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.doSQLUpdate | def doSQLUpdate(sqlString)
sql = sqlString.dup
dbname = ""
state = nil
fieldName = ""
fieldValue = ""
sqlQuery = "SELECT 3 FROM "
clearFieldValuePairList
sql.split(' ').each{ |token|
case token
when "UPDATE"
s... | ruby | def doSQLUpdate(sqlString)
sql = sqlString.dup
dbname = ""
state = nil
fieldName = ""
fieldValue = ""
sqlQuery = "SELECT 3 FROM "
clearFieldValuePairList
sql.split(' ').each{ |token|
case token
when "UPDATE"
s... | [
"def",
"doSQLUpdate",
"(",
"sqlString",
")",
"sql",
"=",
"sqlString",
".",
"dup",
"dbname",
"=",
"\"\"",
"state",
"=",
"nil",
"fieldName",
"=",
"\"\"",
"fieldValue",
"=",
"\"\"",
"sqlQuery",
"=",
"\"SELECT 3 FROM \"",
"clearFieldValuePairList",
"sql",
".",
"sp... | Translate a simple SQL UPDATE statement to a QuickBase editRecord call.
Note: This method is here primarily for Rails integration.
Note: This assumes, like SQL, that your column (i.e. field) names do not contain spaces.
Note: This assumes that Record ID# is the key field in your table. | [
"Translate",
"a",
"simple",
"SQL",
"UPDATE",
"statement",
"to",
"a",
"QuickBase",
"editRecord",
"call",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4828-L4892 |
4,156 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.doSQLInsert | def doSQLInsert(sqlString)
sql = sqlString.dup
dbname = ""
state = nil
fieldName = ""
fieldValue = ""
fieldNames = []
fieldValues = []
index = 0
clearFieldValuePairList
sql.gsub!("("," ")
sql.gsub!(")"," ")
sql.sp... | ruby | def doSQLInsert(sqlString)
sql = sqlString.dup
dbname = ""
state = nil
fieldName = ""
fieldValue = ""
fieldNames = []
fieldValues = []
index = 0
clearFieldValuePairList
sql.gsub!("("," ")
sql.gsub!(")"," ")
sql.sp... | [
"def",
"doSQLInsert",
"(",
"sqlString",
")",
"sql",
"=",
"sqlString",
".",
"dup",
"dbname",
"=",
"\"\"",
"state",
"=",
"nil",
"fieldName",
"=",
"\"\"",
"fieldValue",
"=",
"\"\"",
"fieldNames",
"=",
"[",
"]",
"fieldValues",
"=",
"[",
"]",
"index",
"=",
... | Translate a simple SQL INSERT statement to a QuickBase addRecord call.
Note: This method is here primarily for Rails integration.
Note: This assumes, like SQL, that your column (i.e. field) names do not contain spaces. | [
"Translate",
"a",
"simple",
"SQL",
"INSERT",
"statement",
"to",
"a",
"QuickBase",
"addRecord",
"call",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4898-L4971 |
4,157 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.eachField | def eachField( record = @record )
if record and block_given?
record.each{ |field|
if field.is_a?( REXML::Element) and field.name == "f" and field.attributes["id"]
@field = field
yield field
end
}
end
nil
end | ruby | def eachField( record = @record )
if record and block_given?
record.each{ |field|
if field.is_a?( REXML::Element) and field.name == "f" and field.attributes["id"]
@field = field
yield field
end
}
end
nil
end | [
"def",
"eachField",
"(",
"record",
"=",
"@record",
")",
"if",
"record",
"and",
"block_given?",
"record",
".",
"each",
"{",
"|",
"field",
"|",
"if",
"field",
".",
"is_a?",
"(",
"REXML",
"::",
"Element",
")",
"and",
"field",
".",
"name",
"==",
"\"f\"",
... | Iterate record XML and yield only 'f' elements. | [
"Iterate",
"record",
"XML",
"and",
"yield",
"only",
"f",
"elements",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L4987-L4997 |
4,158 | garethlatwork/quickbase_client | lib/QuickBaseClient.rb | QuickBase.Client.alias_methods | def alias_methods
aliased_methods = []
public_methods.each{|old_method|
if old_method.match(/[A-Z]+/)
new_method = old_method.gsub(/[A-Z]+/){|uc| "_#{uc.downcase}"}
aliased_methods << new_method
instance_eval( "alias #{new_method} #{old_method}")
end
}
... | ruby | def alias_methods
aliased_methods = []
public_methods.each{|old_method|
if old_method.match(/[A-Z]+/)
new_method = old_method.gsub(/[A-Z]+/){|uc| "_#{uc.downcase}"}
aliased_methods << new_method
instance_eval( "alias #{new_method} #{old_method}")
end
}
... | [
"def",
"alias_methods",
"aliased_methods",
"=",
"[",
"]",
"public_methods",
".",
"each",
"{",
"|",
"old_method",
"|",
"if",
"old_method",
".",
"match",
"(",
"/",
"/",
")",
"new_method",
"=",
"old_method",
".",
"gsub",
"(",
"/",
"/",
")",
"{",
"|",
"uc"... | Add method aliases that follow the ruby method naming convention.
E.g. sendRequest will be aliased as send_request. | [
"Add",
"method",
"aliases",
"that",
"follow",
"the",
"ruby",
"method",
"naming",
"convention",
".",
"E",
".",
"g",
".",
"sendRequest",
"will",
"be",
"aliased",
"as",
"send_request",
"."
] | 13d754de1f22a466806c5a0da74b0ded26c23f05 | https://github.com/garethlatwork/quickbase_client/blob/13d754de1f22a466806c5a0da74b0ded26c23f05/lib/QuickBaseClient.rb#L5007-L5017 |
4,159 | sethvargo/community-zero | lib/community_zero/objects/cookbook.rb | CommunityZero.Cookbook.to_hash | def to_hash
methods = instance_variables.map { |i| i.to_s.gsub('@', '') }
Hash[*methods.map { |m| [m, send(m.to_sym)] }.flatten]
end | ruby | def to_hash
methods = instance_variables.map { |i| i.to_s.gsub('@', '') }
Hash[*methods.map { |m| [m, send(m.to_sym)] }.flatten]
end | [
"def",
"to_hash",
"methods",
"=",
"instance_variables",
".",
"map",
"{",
"|",
"i",
"|",
"i",
".",
"to_s",
".",
"gsub",
"(",
"'@'",
",",
"''",
")",
"}",
"Hash",
"[",
"methods",
".",
"map",
"{",
"|",
"m",
"|",
"[",
"m",
",",
"send",
"(",
"m",
"... | Create a new cookbook from the given hash.
@param [Hash] hash
the hash from which to create the cookbook
Dump this cookbook to a hash.
@return [Hash]
the hash representation of this cookbook | [
"Create",
"a",
"new",
"cookbook",
"from",
"the",
"given",
"hash",
"."
] | 08a22c47c865deb6a5f931cb4d9f747a2b9d3459 | https://github.com/sethvargo/community-zero/blob/08a22c47c865deb6a5f931cb4d9f747a2b9d3459/lib/community_zero/objects/cookbook.rb#L36-L39 |
4,160 | scrapper/perobs | lib/perobs/Array.rb | PEROBS.Array._referenced_object_ids | def _referenced_object_ids
@data.each.select do |v|
v && v.respond_to?(:is_poxreference?)
end.map { |o| o.id }
end | ruby | def _referenced_object_ids
@data.each.select do |v|
v && v.respond_to?(:is_poxreference?)
end.map { |o| o.id }
end | [
"def",
"_referenced_object_ids",
"@data",
".",
"each",
".",
"select",
"do",
"|",
"v",
"|",
"v",
"&&",
"v",
".",
"respond_to?",
"(",
":is_poxreference?",
")",
"end",
".",
"map",
"{",
"|",
"o",
"|",
"o",
".",
"id",
"}",
"end"
] | Return a list of all object IDs of all persistend objects that this Array
is referencing.
@return [Array of Integer] IDs of referenced objects | [
"Return",
"a",
"list",
"of",
"all",
"object",
"IDs",
"of",
"all",
"persistend",
"objects",
"that",
"this",
"Array",
"is",
"referencing",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/Array.rb#L145-L149 |
4,161 | pupeno/assert_difference | lib/assert_difference/expectation.rb | AssertDifference.Expectation.generate_expected_value | def generate_expected_value
if expected_difference.is_a? Range
(before_value + expected_difference.first)..(before_value + expected_difference.end)
else
before_value + expected_difference
end
end | ruby | def generate_expected_value
if expected_difference.is_a? Range
(before_value + expected_difference.first)..(before_value + expected_difference.end)
else
before_value + expected_difference
end
end | [
"def",
"generate_expected_value",
"if",
"expected_difference",
".",
"is_a?",
"Range",
"(",
"before_value",
"+",
"expected_difference",
".",
"first",
")",
"..",
"(",
"before_value",
"+",
"expected_difference",
".",
"end",
")",
"else",
"before_value",
"+",
"expected_d... | Generate the expected value.
@return [Integer, Range] Generate the expected value. | [
"Generate",
"the",
"expected",
"value",
"."
] | 56490e7157dd975caed8080abd910a559e3bd785 | https://github.com/pupeno/assert_difference/blob/56490e7157dd975caed8080abd910a559e3bd785/lib/assert_difference/expectation.rb#L77-L83 |
4,162 | PublicHealthEngland/ndr_support | lib/ndr_support/obfuscator.rb | NdrSupport.Obfuscator.obfuscate | def obfuscate(name, seed = nil)
rnd = Random.new(seed || @seed)
vowels = %w(A E I O U)
consonants = ('A'..'Z').to_a - vowels
digits = ('0'..'9').to_a
dict = Hash[(vowels + consonants + digits).zip(vowels.shuffle(random: rnd) +
consonants... | ruby | def obfuscate(name, seed = nil)
rnd = Random.new(seed || @seed)
vowels = %w(A E I O U)
consonants = ('A'..'Z').to_a - vowels
digits = ('0'..'9').to_a
dict = Hash[(vowels + consonants + digits).zip(vowels.shuffle(random: rnd) +
consonants... | [
"def",
"obfuscate",
"(",
"name",
",",
"seed",
"=",
"nil",
")",
"rnd",
"=",
"Random",
".",
"new",
"(",
"seed",
"||",
"@seed",
")",
"vowels",
"=",
"%w(",
"A",
"E",
"I",
"O",
"U",
")",
"consonants",
"=",
"(",
"'A'",
"..",
"'Z'",
")",
".",
"to_a",
... | Obfuscate a name or address, either with the given seed, or default seed | [
"Obfuscate",
"a",
"name",
"or",
"address",
"either",
"with",
"the",
"given",
"seed",
"or",
"default",
"seed"
] | 6daf98ca972e79de1c8457eb720f058b03ead21c | https://github.com/PublicHealthEngland/ndr_support/blob/6daf98ca972e79de1c8457eb720f058b03ead21c/lib/ndr_support/obfuscator.rb#L13-L22 |
4,163 | sethvargo/community-zero | lib/community_zero/server.rb | CommunityZero.Server.start_background | def start_background(wait = 5)
@server = WEBrick::HTTPServer.new(
:BindAddress => @options[:host],
:Port => @options[:port],
:AccessLog => [],
:Logger => WEBrick::Log.new(StringIO.new, 7)
)
@server.mount('/', Rack::Handler::WEBrick, app)
@thread = T... | ruby | def start_background(wait = 5)
@server = WEBrick::HTTPServer.new(
:BindAddress => @options[:host],
:Port => @options[:port],
:AccessLog => [],
:Logger => WEBrick::Log.new(StringIO.new, 7)
)
@server.mount('/', Rack::Handler::WEBrick, app)
@thread = T... | [
"def",
"start_background",
"(",
"wait",
"=",
"5",
")",
"@server",
"=",
"WEBrick",
"::",
"HTTPServer",
".",
"new",
"(",
":BindAddress",
"=>",
"@options",
"[",
":host",
"]",
",",
":Port",
"=>",
"@options",
"[",
":port",
"]",
",",
":AccessLog",
"=>",
"[",
... | Start a Community Zero server in a forked process. This method returns
the PID to the forked process.
@param [Fixnum] wait
the number of seconds to wait for the server to start
@return [Thread]
the thread the background process is running in | [
"Start",
"a",
"Community",
"Zero",
"server",
"in",
"a",
"forked",
"process",
".",
"This",
"method",
"returns",
"the",
"PID",
"to",
"the",
"forked",
"process",
"."
] | 08a22c47c865deb6a5f931cb4d9f747a2b9d3459 | https://github.com/sethvargo/community-zero/blob/08a22c47c865deb6a5f931cb4d9f747a2b9d3459/lib/community_zero/server.rb#L121-L133 |
4,164 | sethvargo/community-zero | lib/community_zero/server.rb | CommunityZero.Server.running? | def running?
if @server.nil? || @server.status != :Running
return false
end
uri = URI.join(url, 'cookbooks')
headers = { 'Accept' => 'application/json' }
Timeout.timeout(0.1) { !open(uri, headers).nil? }
rescue SocketError, Errno::ECONNREFUSED, Timeout::Error
false
... | ruby | def running?
if @server.nil? || @server.status != :Running
return false
end
uri = URI.join(url, 'cookbooks')
headers = { 'Accept' => 'application/json' }
Timeout.timeout(0.1) { !open(uri, headers).nil? }
rescue SocketError, Errno::ECONNREFUSED, Timeout::Error
false
... | [
"def",
"running?",
"if",
"@server",
".",
"nil?",
"||",
"@server",
".",
"status",
"!=",
":Running",
"return",
"false",
"end",
"uri",
"=",
"URI",
".",
"join",
"(",
"url",
",",
"'cookbooks'",
")",
"headers",
"=",
"{",
"'Accept'",
"=>",
"'application/json'",
... | Boolean method to determine if the server is currently ready to accept
requests. This method will attempt to make an HTTP request against the
server. If this method returns true, you are safe to make a request.
@return [Boolean]
true if the server is accepting requests, false otherwise | [
"Boolean",
"method",
"to",
"determine",
"if",
"the",
"server",
"is",
"currently",
"ready",
"to",
"accept",
"requests",
".",
"This",
"method",
"will",
"attempt",
"to",
"make",
"an",
"HTTP",
"request",
"against",
"the",
"server",
".",
"If",
"this",
"method",
... | 08a22c47c865deb6a5f931cb4d9f747a2b9d3459 | https://github.com/sethvargo/community-zero/blob/08a22c47c865deb6a5f931cb4d9f747a2b9d3459/lib/community_zero/server.rb#L143-L154 |
4,165 | sethvargo/community-zero | lib/community_zero/server.rb | CommunityZero.Server.stop | def stop(wait = 5)
Timeout.timeout(wait) do
@server.shutdown
@thread.join(wait) if @thread
end
rescue Timeout::Error
if @thread
$stderr.puts("Community Zero did not stop within #{wait} seconds! Killing...")
@thread.kill
end
ensure
@server = nil
... | ruby | def stop(wait = 5)
Timeout.timeout(wait) do
@server.shutdown
@thread.join(wait) if @thread
end
rescue Timeout::Error
if @thread
$stderr.puts("Community Zero did not stop within #{wait} seconds! Killing...")
@thread.kill
end
ensure
@server = nil
... | [
"def",
"stop",
"(",
"wait",
"=",
"5",
")",
"Timeout",
".",
"timeout",
"(",
"wait",
")",
"do",
"@server",
".",
"shutdown",
"@thread",
".",
"join",
"(",
"wait",
")",
"if",
"@thread",
"end",
"rescue",
"Timeout",
"::",
"Error",
"if",
"@thread",
"$stderr",
... | Gracefully stop the Community Zero server.
@param [Fixnum] wait
the number of seconds to wait before raising force-terminating the
server | [
"Gracefully",
"stop",
"the",
"Community",
"Zero",
"server",
"."
] | 08a22c47c865deb6a5f931cb4d9f747a2b9d3459 | https://github.com/sethvargo/community-zero/blob/08a22c47c865deb6a5f931cb4d9f747a2b9d3459/lib/community_zero/server.rb#L163-L176 |
4,166 | sethvargo/community-zero | lib/community_zero/server.rb | CommunityZero.Server.app | def app
lambda do |env|
request = Request.new(env)
response = router.call(request)
response[-1] = Array(response[-1])
response
end
end | ruby | def app
lambda do |env|
request = Request.new(env)
response = router.call(request)
response[-1] = Array(response[-1])
response
end
end | [
"def",
"app",
"lambda",
"do",
"|",
"env",
"|",
"request",
"=",
"Request",
".",
"new",
"(",
"env",
")",
"response",
"=",
"router",
".",
"call",
"(",
"request",
")",
"response",
"[",
"-",
"1",
"]",
"=",
"Array",
"(",
"response",
"[",
"-",
"1",
"]",... | The actual application the server will respond to.
@return [RackApp] | [
"The",
"actual",
"application",
"the",
"server",
"will",
"respond",
"to",
"."
] | 08a22c47c865deb6a5f931cb4d9f747a2b9d3459 | https://github.com/sethvargo/community-zero/blob/08a22c47c865deb6a5f931cb4d9f747a2b9d3459/lib/community_zero/server.rb#L199-L207 |
4,167 | sethvargo/community-zero | lib/community_zero/endpoints/cookbooks_endpoint.rb | CommunityZero.CookbooksEndpoint.create_cookbook | def create_cookbook(metadata, overrides = {})
cookbook = Cookbook.new({
:name => metadata.name,
:category => nil,
:maintainer => metadata.maintainer,
:description => metadata.description,
:version => metadata.version
}.merge(overrides))
... | ruby | def create_cookbook(metadata, overrides = {})
cookbook = Cookbook.new({
:name => metadata.name,
:category => nil,
:maintainer => metadata.maintainer,
:description => metadata.description,
:version => metadata.version
}.merge(overrides))
... | [
"def",
"create_cookbook",
"(",
"metadata",
",",
"overrides",
"=",
"{",
"}",
")",
"cookbook",
"=",
"Cookbook",
".",
"new",
"(",
"{",
":name",
"=>",
"metadata",
".",
"name",
",",
":category",
"=>",
"nil",
",",
":maintainer",
"=>",
"metadata",
".",
"maintai... | Create the cookbook from the metadata.
@param [CommunityZero::Metadata] metadata
the metadata to create the cookbook from | [
"Create",
"the",
"cookbook",
"from",
"the",
"metadata",
"."
] | 08a22c47c865deb6a5f931cb4d9f747a2b9d3459 | https://github.com/sethvargo/community-zero/blob/08a22c47c865deb6a5f931cb4d9f747a2b9d3459/lib/community_zero/endpoints/cookbooks_endpoint.rb#L71-L83 |
4,168 | sethvargo/community-zero | lib/community_zero/endpoints/cookbooks_endpoint.rb | CommunityZero.CookbooksEndpoint.find_metadata | def find_metadata(tarball)
gzip = Zlib::GzipReader.new(tarball[:tempfile])
tar = Gem::Package::TarReader.new(gzip)
tar.each do |entry|
if entry.full_name =~ /metadata\.json$/
return Metadata.from_json(entry.read)
elsif entry.full_name =~ /metadata\.rb$/
... | ruby | def find_metadata(tarball)
gzip = Zlib::GzipReader.new(tarball[:tempfile])
tar = Gem::Package::TarReader.new(gzip)
tar.each do |entry|
if entry.full_name =~ /metadata\.json$/
return Metadata.from_json(entry.read)
elsif entry.full_name =~ /metadata\.rb$/
... | [
"def",
"find_metadata",
"(",
"tarball",
")",
"gzip",
"=",
"Zlib",
"::",
"GzipReader",
".",
"new",
"(",
"tarball",
"[",
":tempfile",
"]",
")",
"tar",
"=",
"Gem",
"::",
"Package",
"::",
"TarReader",
".",
"new",
"(",
"gzip",
")",
"tar",
".",
"each",
"do... | Parse the metadata from the tarball.
@param [Tempfile] tarball
the temporarily uploaded file
@return [Metadata] | [
"Parse",
"the",
"metadata",
"from",
"the",
"tarball",
"."
] | 08a22c47c865deb6a5f931cb4d9f747a2b9d3459 | https://github.com/sethvargo/community-zero/blob/08a22c47c865deb6a5f931cb4d9f747a2b9d3459/lib/community_zero/endpoints/cookbooks_endpoint.rb#L91-L104 |
4,169 | holtrop/ruby-gnucash | lib/gnucash/account.rb | Gnucash.Account.finalize | def finalize
@transactions.sort! { |a, b| a.date <=> b.date }
balance = Value.new(0)
@balances = @transactions.map do |act_txn|
balance += act_txn.value
{
date: act_txn.date,
value: balance,
}
end
end | ruby | def finalize
@transactions.sort! { |a, b| a.date <=> b.date }
balance = Value.new(0)
@balances = @transactions.map do |act_txn|
balance += act_txn.value
{
date: act_txn.date,
value: balance,
}
end
end | [
"def",
"finalize",
"@transactions",
".",
"sort!",
"{",
"|",
"a",
",",
"b",
"|",
"a",
".",
"date",
"<=>",
"b",
".",
"date",
"}",
"balance",
"=",
"Value",
".",
"new",
"(",
"0",
")",
"@balances",
"=",
"@transactions",
".",
"map",
"do",
"|",
"act_txn",... | Internal method used to complete initialization of the Account after
all transactions have been associated with it.
@return [void] | [
"Internal",
"method",
"used",
"to",
"complete",
"initialization",
"of",
"the",
"Account",
"after",
"all",
"transactions",
"have",
"been",
"associated",
"with",
"it",
"."
] | a233cc4da0f36b13bc3f7a17264adb82c8a12c6b | https://github.com/holtrop/ruby-gnucash/blob/a233cc4da0f36b13bc3f7a17264adb82c8a12c6b/lib/gnucash/account.rb#L78-L88 |
4,170 | snowplow/iglu-ruby-client | lib/iglu-client/resolver.rb | Iglu.Resolver.lookup_schema | def lookup_schema(schema_key)
lookup_time = Time.now.getutc
if schema_key.is_a?(String)
schema_key = SchemaKey.parse_key(schema_key)
end
failures = []
cache_result = @cache[schema_key]
if not cache_result.nil?
if not @cacheTtl.nil?
store_time = cache_result... | ruby | def lookup_schema(schema_key)
lookup_time = Time.now.getutc
if schema_key.is_a?(String)
schema_key = SchemaKey.parse_key(schema_key)
end
failures = []
cache_result = @cache[schema_key]
if not cache_result.nil?
if not @cacheTtl.nil?
store_time = cache_result... | [
"def",
"lookup_schema",
"(",
"schema_key",
")",
"lookup_time",
"=",
"Time",
".",
"now",
".",
"getutc",
"if",
"schema_key",
".",
"is_a?",
"(",
"String",
")",
"schema_key",
"=",
"SchemaKey",
".",
"parse_key",
"(",
"schema_key",
")",
"end",
"failures",
"=",
"... | Lookup schema in cache or try to fetch | [
"Lookup",
"schema",
"in",
"cache",
"or",
"try",
"to",
"fetch"
] | 6d41668dc3e5615e3358a952e193812b5c4b3d6b | https://github.com/snowplow/iglu-ruby-client/blob/6d41668dc3e5615e3358a952e193812b5c4b3d6b/lib/iglu-client/resolver.rb#L28-L74 |
4,171 | snowplow/iglu-ruby-client | lib/iglu-client/resolver.rb | Iglu.Resolver.validate | def validate(json)
schema_key = Resolver.get_schema_key json
data = Resolver.get_data json
schema = lookup_schema schema_key
JSON::Validator.validate!(schema, data)
end | ruby | def validate(json)
schema_key = Resolver.get_schema_key json
data = Resolver.get_data json
schema = lookup_schema schema_key
JSON::Validator.validate!(schema, data)
end | [
"def",
"validate",
"(",
"json",
")",
"schema_key",
"=",
"Resolver",
".",
"get_schema_key",
"json",
"data",
"=",
"Resolver",
".",
"get_data",
"json",
"schema",
"=",
"lookup_schema",
"schema_key",
"JSON",
"::",
"Validator",
".",
"validate!",
"(",
"schema",
",",
... | Return true or throw exception | [
"Return",
"true",
"or",
"throw",
"exception"
] | 6d41668dc3e5615e3358a952e193812b5c4b3d6b | https://github.com/snowplow/iglu-ruby-client/blob/6d41668dc3e5615e3358a952e193812b5c4b3d6b/lib/iglu-client/resolver.rb#L119-L124 |
4,172 | code-and-effect/effective_pages | app/models/effective/menu_item.rb | Effective.MenuItem.visible_for? | def visible_for?(user)
can_view_page = (
if dropdown?
true
elsif menuable.kind_of?(Effective::Page)
menuable.roles_permit?(user)
else
true
end
)
can_view_menu_item = (
if roles_mask == nil
true
elsif roles_mask ==... | ruby | def visible_for?(user)
can_view_page = (
if dropdown?
true
elsif menuable.kind_of?(Effective::Page)
menuable.roles_permit?(user)
else
true
end
)
can_view_menu_item = (
if roles_mask == nil
true
elsif roles_mask ==... | [
"def",
"visible_for?",
"(",
"user",
")",
"can_view_page",
"=",
"(",
"if",
"dropdown?",
"true",
"elsif",
"menuable",
".",
"kind_of?",
"(",
"Effective",
"::",
"Page",
")",
"menuable",
".",
"roles_permit?",
"(",
"user",
")",
"else",
"true",
"end",
")",
"can_v... | For now it's just logged in or not?
This will work with effective_roles one day... | [
"For",
"now",
"it",
"s",
"just",
"logged",
"in",
"or",
"not?",
"This",
"will",
"work",
"with",
"effective_roles",
"one",
"day",
"..."
] | ff00e2d76055985ab65f570747bc9a5f2748f817 | https://github.com/code-and-effect/effective_pages/blob/ff00e2d76055985ab65f570747bc9a5f2748f817/app/models/effective/menu_item.rb#L51-L75 |
4,173 | scrapper/perobs | lib/perobs/Store.rb | PEROBS.Store.copy | def copy(dir, options = {})
# Make sure all objects are persisted.
sync
# Create a new store with the specified directory and options.
new_db = Store.new(dir, options)
# Clear the cache.
new_db.sync
# Copy all objects of the existing store to the new store.
i = 0
e... | ruby | def copy(dir, options = {})
# Make sure all objects are persisted.
sync
# Create a new store with the specified directory and options.
new_db = Store.new(dir, options)
# Clear the cache.
new_db.sync
# Copy all objects of the existing store to the new store.
i = 0
e... | [
"def",
"copy",
"(",
"dir",
",",
"options",
"=",
"{",
"}",
")",
"# Make sure all objects are persisted.",
"sync",
"# Create a new store with the specified directory and options.",
"new_db",
"=",
"Store",
".",
"new",
"(",
"dir",
",",
"options",
")",
"# Clear the cache.",
... | Create a new Store.
@param data_base [String] the name of the database
@param options [Hash] various options to affect the operation of the
database. Currently the following options are supported:
:engine : The class that provides the back-end storage
engine. By default FlatF... | [
"Create",
"a",
"new",
"Store",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/Store.rb#L183-L204 |
4,174 | scrapper/perobs | lib/perobs/Store.rb | PEROBS.Store.exit | def exit
if @cache && @cache.in_transaction?
@cache.abort_transaction
@cache.flush
@db.close if @db
PEROBS.log.fatal "You cannot call exit() during a transaction: #{Kernel.caller}"
end
@cache.flush if @cache
@db.close if @db
@db = @class_map = @in_memory_obj... | ruby | def exit
if @cache && @cache.in_transaction?
@cache.abort_transaction
@cache.flush
@db.close if @db
PEROBS.log.fatal "You cannot call exit() during a transaction: #{Kernel.caller}"
end
@cache.flush if @cache
@db.close if @db
@db = @class_map = @in_memory_obj... | [
"def",
"exit",
"if",
"@cache",
"&&",
"@cache",
".",
"in_transaction?",
"@cache",
".",
"abort_transaction",
"@cache",
".",
"flush",
"@db",
".",
"close",
"if",
"@db",
"PEROBS",
".",
"log",
".",
"fatal",
"\"You cannot call exit() during a transaction: #{Kernel.caller}\""... | Close the store and ensure that all in-memory objects are written out to
the storage backend. The Store object is no longer usable after this
method was called. | [
"Close",
"the",
"store",
"and",
"ensure",
"that",
"all",
"in",
"-",
"memory",
"objects",
"are",
"written",
"out",
"to",
"the",
"storage",
"backend",
".",
"The",
"Store",
"object",
"is",
"no",
"longer",
"usable",
"after",
"this",
"method",
"was",
"called",
... | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/Store.rb#L210-L221 |
4,175 | scrapper/perobs | lib/perobs/Store.rb | PEROBS.Store.new | def new(klass, *args)
unless klass.is_a?(BasicObject)
PEROBS.log.fatal "#{klass} is not a BasicObject derivative"
end
obj = _construct_po(klass, _new_id, *args)
# Mark the new object as modified so it gets pushed into the database.
@cache.cache_write(obj)
# Return a POXRefer... | ruby | def new(klass, *args)
unless klass.is_a?(BasicObject)
PEROBS.log.fatal "#{klass} is not a BasicObject derivative"
end
obj = _construct_po(klass, _new_id, *args)
# Mark the new object as modified so it gets pushed into the database.
@cache.cache_write(obj)
# Return a POXRefer... | [
"def",
"new",
"(",
"klass",
",",
"*",
"args",
")",
"unless",
"klass",
".",
"is_a?",
"(",
"BasicObject",
")",
"PEROBS",
".",
"log",
".",
"fatal",
"\"#{klass} is not a BasicObject derivative\"",
"end",
"obj",
"=",
"_construct_po",
"(",
"klass",
",",
"_new_id",
... | You need to call this method to create new PEROBS objects that belong to
this Store.
@param klass [Class] The class of the object you want to create. This
must be a derivative of ObjectBase.
@param args Optional list of other arguments that are passed to the
constructor of the specified class.
@retu... | [
"You",
"need",
"to",
"call",
"this",
"method",
"to",
"create",
"new",
"PEROBS",
"objects",
"that",
"belong",
"to",
"this",
"Store",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/Store.rb#L231-L241 |
4,176 | scrapper/perobs | lib/perobs/Store.rb | PEROBS.Store._construct_po | def _construct_po(klass, id, *args)
klass.new(Handle.new(self, id), *args)
end | ruby | def _construct_po(klass, id, *args)
klass.new(Handle.new(self, id), *args)
end | [
"def",
"_construct_po",
"(",
"klass",
",",
"id",
",",
"*",
"args",
")",
"klass",
".",
"new",
"(",
"Handle",
".",
"new",
"(",
"self",
",",
"id",
")",
",",
"args",
")",
"end"
] | For library internal use only!
This method will create a new PEROBS object.
@param klass [BasicObject] Class of the object to create
@param id [Integer] Requested object ID
@param args [Array] Arguments to pass to the object constructor.
@return [BasicObject] Newly constructed PEROBS object | [
"For",
"library",
"internal",
"use",
"only!",
"This",
"method",
"will",
"create",
"a",
"new",
"PEROBS",
"object",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/Store.rb#L249-L251 |
4,177 | scrapper/perobs | lib/perobs/Store.rb | PEROBS.Store.sync | def sync
if @cache.in_transaction?
@cache.abort_transaction
@cache.flush
PEROBS.log.fatal "You cannot call sync() during a transaction: \n" +
Kernel.caller.join("\n")
end
@cache.flush
end | ruby | def sync
if @cache.in_transaction?
@cache.abort_transaction
@cache.flush
PEROBS.log.fatal "You cannot call sync() during a transaction: \n" +
Kernel.caller.join("\n")
end
@cache.flush
end | [
"def",
"sync",
"if",
"@cache",
".",
"in_transaction?",
"@cache",
".",
"abort_transaction",
"@cache",
".",
"flush",
"PEROBS",
".",
"log",
".",
"fatal",
"\"You cannot call sync() during a transaction: \\n\"",
"+",
"Kernel",
".",
"caller",
".",
"join",
"(",
"\"\\n\"",
... | Flush out all modified objects to disk and shrink the in-memory list if
needed. | [
"Flush",
"out",
"all",
"modified",
"objects",
"to",
"disk",
"and",
"shrink",
"the",
"in",
"-",
"memory",
"list",
"if",
"needed",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/Store.rb#L313-L321 |
4,178 | scrapper/perobs | lib/perobs/Store.rb | PEROBS.Store.object_by_id | def object_by_id(id)
if (ruby_object_id = @in_memory_objects[id])
# We have the object in memory so we can just return it.
begin
object = ObjectSpace._id2ref(ruby_object_id)
# Let's make sure the object is really the object we are looking
# for. The GC might have recy... | ruby | def object_by_id(id)
if (ruby_object_id = @in_memory_objects[id])
# We have the object in memory so we can just return it.
begin
object = ObjectSpace._id2ref(ruby_object_id)
# Let's make sure the object is really the object we are looking
# for. The GC might have recy... | [
"def",
"object_by_id",
"(",
"id",
")",
"if",
"(",
"ruby_object_id",
"=",
"@in_memory_objects",
"[",
"id",
"]",
")",
"# We have the object in memory so we can just return it.",
"begin",
"object",
"=",
"ObjectSpace",
".",
"_id2ref",
"(",
"ruby_object_id",
")",
"# Let's ... | Return the object with the provided ID. This method is not part of the
public API and should never be called by outside users. It's purely
intended for internal use. | [
"Return",
"the",
"object",
"with",
"the",
"provided",
"ID",
".",
"This",
"method",
"is",
"not",
"part",
"of",
"the",
"public",
"API",
"and",
"should",
"never",
"be",
"called",
"by",
"outside",
"users",
".",
"It",
"s",
"purely",
"intended",
"for",
"intern... | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/Store.rb#L347-L384 |
4,179 | scrapper/perobs | lib/perobs/Store.rb | PEROBS.Store.check | def check(repair = false)
stats = { :errors => 0, :object_cnt => 0 }
# All objects must have in-db version.
sync
# Run basic consistency checks first.
stats[:errors] += @db.check_db(repair)
# We will use the mark to mark all objects that we have checked already.
# Before we s... | ruby | def check(repair = false)
stats = { :errors => 0, :object_cnt => 0 }
# All objects must have in-db version.
sync
# Run basic consistency checks first.
stats[:errors] += @db.check_db(repair)
# We will use the mark to mark all objects that we have checked already.
# Before we s... | [
"def",
"check",
"(",
"repair",
"=",
"false",
")",
"stats",
"=",
"{",
":errors",
"=>",
"0",
",",
":object_cnt",
"=>",
"0",
"}",
"# All objects must have in-db version.",
"sync",
"# Run basic consistency checks first.",
"stats",
"[",
":errors",
"]",
"+=",
"@db",
"... | This method can be used to check the database and optionally repair it.
The repair is a pure structural repair. It cannot ensure that the stored
data is still correct. E. g. if a reference to a non-existing or
unreadable object is found, the reference will simply be deleted.
@param repair [TrueClass/FalseClass] tru... | [
"This",
"method",
"can",
"be",
"used",
"to",
"check",
"the",
"database",
"and",
"optionally",
"repair",
"it",
".",
"The",
"repair",
"is",
"a",
"pure",
"structural",
"repair",
".",
"It",
"cannot",
"ensure",
"that",
"the",
"stored",
"data",
"is",
"still",
... | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/Store.rb#L393-L439 |
4,180 | scrapper/perobs | lib/perobs/Store.rb | PEROBS.Store.each | def each
@db.clear_marks
# Start with the object 0 and the indexes of the root objects. Push them
# onto the work stack.
stack = [ 0 ] + @root_objects.values
while !stack.empty?
# Get an object index from the stack.
id = stack.pop
next if @db.is_marked?(id)
... | ruby | def each
@db.clear_marks
# Start with the object 0 and the indexes of the root objects. Push them
# onto the work stack.
stack = [ 0 ] + @root_objects.values
while !stack.empty?
# Get an object index from the stack.
id = stack.pop
next if @db.is_marked?(id)
... | [
"def",
"each",
"@db",
".",
"clear_marks",
"# Start with the object 0 and the indexes of the root objects. Push them",
"# onto the work stack.",
"stack",
"=",
"[",
"0",
"]",
"+",
"@root_objects",
".",
"values",
"while",
"!",
"stack",
".",
"empty?",
"# Get an object index fro... | Calls the given block once for each object, passing that object as a
parameter. | [
"Calls",
"the",
"given",
"block",
"once",
"for",
"each",
"object",
"passing",
"that",
"object",
"as",
"a",
"parameter",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/Store.rb#L460-L482 |
4,181 | scrapper/perobs | lib/perobs/Store.rb | PEROBS.Store.mark | def mark
classes = Set.new
marked_objects = 0
@progressmeter.start("Marking linked objects", @db.item_counter) do
each do |obj|
classes.add(obj.class)
@progressmeter.update(marked_objects += 1)
end
end
@class_map.keep(classes.map { |c| c.to_s })
#... | ruby | def mark
classes = Set.new
marked_objects = 0
@progressmeter.start("Marking linked objects", @db.item_counter) do
each do |obj|
classes.add(obj.class)
@progressmeter.update(marked_objects += 1)
end
end
@class_map.keep(classes.map { |c| c.to_s })
#... | [
"def",
"mark",
"classes",
"=",
"Set",
".",
"new",
"marked_objects",
"=",
"0",
"@progressmeter",
".",
"start",
"(",
"\"Marking linked objects\"",
",",
"@db",
".",
"item_counter",
")",
"do",
"each",
"do",
"|",
"obj",
"|",
"classes",
".",
"add",
"(",
"obj",
... | Mark phase of a mark-and-sweep garbage collector. It will mark all
objects that are reachable from the root objects. | [
"Mark",
"phase",
"of",
"a",
"mark",
"-",
"and",
"-",
"sweep",
"garbage",
"collector",
".",
"It",
"will",
"mark",
"all",
"objects",
"that",
"are",
"reachable",
"from",
"the",
"root",
"objects",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/Store.rb#L538-L554 |
4,182 | scrapper/perobs | lib/perobs/Store.rb | PEROBS.Store.check_object | def check_object(start_id, repair, stats)
@db.mark(start_id)
# The todo list holds a touple for each object that still needs to be
# checked. The first item is the referring object and the second is the
# ID of the object to check.
todo_list = [ [ nil, start_id ] ]
while !todo_list.... | ruby | def check_object(start_id, repair, stats)
@db.mark(start_id)
# The todo list holds a touple for each object that still needs to be
# checked. The first item is the referring object and the second is the
# ID of the object to check.
todo_list = [ [ nil, start_id ] ]
while !todo_list.... | [
"def",
"check_object",
"(",
"start_id",
",",
"repair",
",",
"stats",
")",
"@db",
".",
"mark",
"(",
"start_id",
")",
"# The todo list holds a touple for each object that still needs to be",
"# checked. The first item is the referring object and the second is the",
"# ID of the objec... | Check the object with the given start_id and all other objects that are
somehow reachable from the start object.
@param start_id [Integer] ID of the top-level object to start
with
@param repair [Boolean] Delete refernces to broken objects if true
@return [Integer] The number of references to bad objects. | [
"Check",
"the",
"object",
"with",
"the",
"given",
"start_id",
"and",
"all",
"other",
"objects",
"that",
"are",
"somehow",
"reachable",
"from",
"the",
"start",
"object",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/Store.rb#L571-L616 |
4,183 | scrapper/perobs | lib/perobs/Object.rb | PEROBS.Object._referenced_object_ids | def _referenced_object_ids
ids = []
_all_attributes.each do |attr|
value = instance_variable_get(('@' + attr.to_s).to_sym)
ids << value.id if value && value.respond_to?(:is_poxreference?)
end
ids
end | ruby | def _referenced_object_ids
ids = []
_all_attributes.each do |attr|
value = instance_variable_get(('@' + attr.to_s).to_sym)
ids << value.id if value && value.respond_to?(:is_poxreference?)
end
ids
end | [
"def",
"_referenced_object_ids",
"ids",
"=",
"[",
"]",
"_all_attributes",
".",
"each",
"do",
"|",
"attr",
"|",
"value",
"=",
"instance_variable_get",
"(",
"(",
"'@'",
"+",
"attr",
".",
"to_s",
")",
".",
"to_sym",
")",
"ids",
"<<",
"value",
".",
"id",
"... | Return a list of all object IDs that the attributes of this instance are
referencing.
@return [Array of Integer] IDs of referenced objects | [
"Return",
"a",
"list",
"of",
"all",
"object",
"IDs",
"that",
"the",
"attributes",
"of",
"this",
"instance",
"are",
"referencing",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/Object.rb#L149-L156 |
4,184 | scrapper/perobs | lib/perobs/Object.rb | PEROBS.Object._delete_reference_to_id | def _delete_reference_to_id(id)
_all_attributes.each do |attr|
ivar = ('@' + attr.to_s).to_sym
value = instance_variable_get(ivar)
if value && value.respond_to?(:is_poxreference?) && value.id == id
instance_variable_set(ivar, nil)
end
end
mark_as_modified
... | ruby | def _delete_reference_to_id(id)
_all_attributes.each do |attr|
ivar = ('@' + attr.to_s).to_sym
value = instance_variable_get(ivar)
if value && value.respond_to?(:is_poxreference?) && value.id == id
instance_variable_set(ivar, nil)
end
end
mark_as_modified
... | [
"def",
"_delete_reference_to_id",
"(",
"id",
")",
"_all_attributes",
".",
"each",
"do",
"|",
"attr",
"|",
"ivar",
"=",
"(",
"'@'",
"+",
"attr",
".",
"to_s",
")",
".",
"to_sym",
"value",
"=",
"instance_variable_get",
"(",
"ivar",
")",
"if",
"value",
"&&",... | This method should only be used during store repair operations. It will
delete all references to the given object ID.
@param id [Integer] targeted object ID | [
"This",
"method",
"should",
"only",
"be",
"used",
"during",
"store",
"repair",
"operations",
".",
"It",
"will",
"delete",
"all",
"references",
"to",
"the",
"given",
"object",
"ID",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/Object.rb#L161-L170 |
4,185 | scrapper/perobs | lib/perobs/Object.rb | PEROBS.Object.inspect | def inspect
"<#{self.class}:#{@_id}>\n{\n" +
_all_attributes.map do |attr|
ivar = ('@' + attr.to_s).to_sym
if (value = instance_variable_get(ivar)).respond_to?(:is_poxreference?)
" #{attr} => <PEROBS::ObjectBase:#{value._id}>"
else
" #{attr} => #{value.inspect}"... | ruby | def inspect
"<#{self.class}:#{@_id}>\n{\n" +
_all_attributes.map do |attr|
ivar = ('@' + attr.to_s).to_sym
if (value = instance_variable_get(ivar)).respond_to?(:is_poxreference?)
" #{attr} => <PEROBS::ObjectBase:#{value._id}>"
else
" #{attr} => #{value.inspect}"... | [
"def",
"inspect",
"\"<#{self.class}:#{@_id}>\\n{\\n\"",
"+",
"_all_attributes",
".",
"map",
"do",
"|",
"attr",
"|",
"ivar",
"=",
"(",
"'@'",
"+",
"attr",
".",
"to_s",
")",
".",
"to_sym",
"if",
"(",
"value",
"=",
"instance_variable_get",
"(",
"ivar",
")",
"... | Textual dump for debugging purposes
@return [String] | [
"Textual",
"dump",
"for",
"debugging",
"purposes"
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/Object.rb#L186-L197 |
4,186 | scrapper/perobs | lib/perobs/Object.rb | PEROBS.Object._serialize | def _serialize
attributes = {}
_all_attributes.each do |attr|
ivar = ('@' + attr.to_s).to_sym
value = instance_variable_get(ivar)
attributes[attr.to_s] = value.respond_to?(:is_poxreference?) ?
POReference.new(value.id) : value
end
attributes
end | ruby | def _serialize
attributes = {}
_all_attributes.each do |attr|
ivar = ('@' + attr.to_s).to_sym
value = instance_variable_get(ivar)
attributes[attr.to_s] = value.respond_to?(:is_poxreference?) ?
POReference.new(value.id) : value
end
attributes
end | [
"def",
"_serialize",
"attributes",
"=",
"{",
"}",
"_all_attributes",
".",
"each",
"do",
"|",
"attr",
"|",
"ivar",
"=",
"(",
"'@'",
"+",
"attr",
".",
"to_s",
")",
".",
"to_sym",
"value",
"=",
"instance_variable_get",
"(",
"ivar",
")",
"attributes",
"[",
... | Return a single data structure that holds all persistent data for this
class. | [
"Return",
"a",
"single",
"data",
"structure",
"that",
"holds",
"all",
"persistent",
"data",
"for",
"this",
"class",
"."
] | 1c9327656912cf96683849f92d260546af856adf | https://github.com/scrapper/perobs/blob/1c9327656912cf96683849f92d260546af856adf/lib/perobs/Object.rb#L203-L212 |
4,187 | danielpclark/PolyBelongsTo | lib/poly_belongs_to/singleton_set.rb | PolyBelongsTo.SingletonSet.add? | def add?(record)
result = @set.add?( formatted_name( record ) )
return result if result
flag(record)
result
end | ruby | def add?(record)
result = @set.add?( formatted_name( record ) )
return result if result
flag(record)
result
end | [
"def",
"add?",
"(",
"record",
")",
"result",
"=",
"@set",
".",
"add?",
"(",
"formatted_name",
"(",
"record",
")",
")",
"return",
"result",
"if",
"result",
"flag",
"(",
"record",
")",
"result",
"end"
] | Add record to set. Flag if covered already.
@param record [Object] ActiveRecord object instance
@return [Object, nil] Object if added safely, nil otherwise | [
"Add",
"record",
"to",
"set",
".",
"Flag",
"if",
"covered",
"already",
"."
] | 38d51d37f9148613519d6b6d56bdf4d0884f0e86 | https://github.com/danielpclark/PolyBelongsTo/blob/38d51d37f9148613519d6b6d56bdf4d0884f0e86/lib/poly_belongs_to/singleton_set.rb#L24-L29 |
4,188 | danielpclark/PolyBelongsTo | lib/poly_belongs_to/singleton_set.rb | PolyBelongsTo.SingletonSet.method_missing | def method_missing(mthd, *args, &block)
new_recs = args.reduce([]) {|a, i| a.push(formatted_name(i)) if i.class.ancestors.include?(ActiveRecord::Base); a}
result = @set.send(mthd,
*(args.map do |arg|
arg.class.ancestors.include?(ActiveRecord::Base) ? formatted_name(arg) : arg
e... | ruby | def method_missing(mthd, *args, &block)
new_recs = args.reduce([]) {|a, i| a.push(formatted_name(i)) if i.class.ancestors.include?(ActiveRecord::Base); a}
result = @set.send(mthd,
*(args.map do |arg|
arg.class.ancestors.include?(ActiveRecord::Base) ? formatted_name(arg) : arg
e... | [
"def",
"method_missing",
"(",
"mthd",
",",
"*",
"args",
",",
"&",
"block",
")",
"new_recs",
"=",
"args",
".",
"reduce",
"(",
"[",
"]",
")",
"{",
"|",
"a",
",",
"i",
"|",
"a",
".",
"push",
"(",
"formatted_name",
"(",
"i",
")",
")",
"if",
"i",
... | method_missing will transform any record argument into a formatted string and pass the
method and arguments on to the internal Set. Also will flag any existing records covered. | [
"method_missing",
"will",
"transform",
"any",
"record",
"argument",
"into",
"a",
"formatted",
"string",
"and",
"pass",
"the",
"method",
"and",
"arguments",
"on",
"to",
"the",
"internal",
"Set",
".",
"Also",
"will",
"flag",
"any",
"existing",
"records",
"covere... | 38d51d37f9148613519d6b6d56bdf4d0884f0e86 | https://github.com/danielpclark/PolyBelongsTo/blob/38d51d37f9148613519d6b6d56bdf4d0884f0e86/lib/poly_belongs_to/singleton_set.rb#L56-L67 |
4,189 | Absolight/epp-client | lib/epp-client/xml.rb | EPPClient.XML.get_result | def get_result(args)
xml = case args
when Hash
args.delete(:xml)
else
xml = args
args = {}
xml
end
args[:range] ||= 1000..1999
if !(mq = xml.xpath('epp:epp/epp:response/epp:msgQ', EPPClient::SCHEMAS_URL)).emp... | ruby | def get_result(args)
xml = case args
when Hash
args.delete(:xml)
else
xml = args
args = {}
xml
end
args[:range] ||= 1000..1999
if !(mq = xml.xpath('epp:epp/epp:response/epp:msgQ', EPPClient::SCHEMAS_URL)).emp... | [
"def",
"get_result",
"(",
"args",
")",
"xml",
"=",
"case",
"args",
"when",
"Hash",
"args",
".",
"delete",
"(",
":xml",
")",
"else",
"xml",
"=",
"args",
"args",
"=",
"{",
"}",
"xml",
"end",
"args",
"[",
":range",
"]",
"||=",
"1000",
"..",
"1999",
... | Takes a xml response and checks that the result is in the right range of
results, that is, between 1000 and 1999, which are results meaning all
went well.
In case all went well, it either calls the callback if given, or returns
true.
In case there was a problem, an EPPErrorResponse exception is raised. | [
"Takes",
"a",
"xml",
"response",
"and",
"checks",
"that",
"the",
"result",
"is",
"in",
"the",
"right",
"range",
"of",
"results",
"that",
"is",
"between",
"1000",
"and",
"1999",
"which",
"are",
"results",
"meaning",
"all",
"went",
"well",
"."
] | c0025daee5e7087f60b654595a8e7d92e966c54e | https://github.com/Absolight/epp-client/blob/c0025daee5e7087f60b654595a8e7d92e966c54e/lib/epp-client/xml.rb#L50-L88 |
4,190 | Absolight/epp-client | lib/epp-client/xml.rb | EPPClient.XML.command | def command(*args, &_block)
builder do |xml|
xml.command do
if block_given?
yield xml
else
command = args.shift
command.call(xml)
args.each do |ext|
xml.extension do
ext.call(xml)
end
... | ruby | def command(*args, &_block)
builder do |xml|
xml.command do
if block_given?
yield xml
else
command = args.shift
command.call(xml)
args.each do |ext|
xml.extension do
ext.call(xml)
end
... | [
"def",
"command",
"(",
"*",
"args",
",",
"&",
"_block",
")",
"builder",
"do",
"|",
"xml",
"|",
"xml",
".",
"command",
"do",
"if",
"block_given?",
"yield",
"xml",
"else",
"command",
"=",
"args",
".",
"shift",
"command",
".",
"call",
"(",
"xml",
")",
... | Creates the xml for the command.
You can either pass a block to it, in that case, it's the command body,
or a series of procs, the first one being the commands, the other ones
being the extensions.
command do |xml|
xml.logout
end
or
command(lambda do |xml|
xml.logout
end, lambda do |... | [
"Creates",
"the",
"xml",
"for",
"the",
"command",
"."
] | c0025daee5e7087f60b654595a8e7d92e966c54e | https://github.com/Absolight/epp-client/blob/c0025daee5e7087f60b654595a8e7d92e966c54e/lib/epp-client/xml.rb#L114-L131 |
4,191 | regru/reg_api2-ruby | lib/reg_api2/action.rb | RegApi2.Action.create_http | def create_http
http = Net::HTTP.new(
API_URI.host,
API_URI.port
)
http.use_ssl = true
apply_ca_cert_path(http)
apply_pem(http)
http
end | ruby | def create_http
http = Net::HTTP.new(
API_URI.host,
API_URI.port
)
http.use_ssl = true
apply_ca_cert_path(http)
apply_pem(http)
http
end | [
"def",
"create_http",
"http",
"=",
"Net",
"::",
"HTTP",
".",
"new",
"(",
"API_URI",
".",
"host",
",",
"API_URI",
".",
"port",
")",
"http",
".",
"use_ssl",
"=",
"true",
"apply_ca_cert_path",
"(",
"http",
")",
"apply_pem",
"(",
"http",
")",
"http",
"end"... | Creates HTTPS handler.
@return [Net::HTTP] HTTPS handler.
@see #http | [
"Creates",
"HTTPS",
"handler",
"."
] | 82fadffc9da6534761003b8a33edb77ab617df70 | https://github.com/regru/reg_api2-ruby/blob/82fadffc9da6534761003b8a33edb77ab617df70/lib/reg_api2/action.rb#L48-L57 |
4,192 | regru/reg_api2-ruby | lib/reg_api2/action.rb | RegApi2.Action.get_form_data | def get_form_data(defopts, opts)
# HACK: REG.API doesn't know about utf-8.
io_encoding = 'utf8' if !io_encoding || io_encoding == DEFAULT_IO_ENCODING
opts = opts.to_hash if opts.respond_to?(:to_hash)
req_contract = RegApi2::RequestContract.new(defopts)
opts = req_contract.validate(opts)
... | ruby | def get_form_data(defopts, opts)
# HACK: REG.API doesn't know about utf-8.
io_encoding = 'utf8' if !io_encoding || io_encoding == DEFAULT_IO_ENCODING
opts = opts.to_hash if opts.respond_to?(:to_hash)
req_contract = RegApi2::RequestContract.new(defopts)
opts = req_contract.validate(opts)
... | [
"def",
"get_form_data",
"(",
"defopts",
",",
"opts",
")",
"# HACK: REG.API doesn't know about utf-8.",
"io_encoding",
"=",
"'utf8'",
"if",
"!",
"io_encoding",
"||",
"io_encoding",
"==",
"DEFAULT_IO_ENCODING",
"opts",
"=",
"opts",
".",
"to_hash",
"if",
"opts",
".",
... | Gets form data for POST request
@param [Hash] defopts
@param [Hash] opts
@return [Hash] Form data to be sent.
@raise [ContractError] | [
"Gets",
"form",
"data",
"for",
"POST",
"request"
] | 82fadffc9da6534761003b8a33edb77ab617df70 | https://github.com/regru/reg_api2-ruby/blob/82fadffc9da6534761003b8a33edb77ab617df70/lib/reg_api2/action.rb#L83-L102 |
4,193 | radar/summer | lib/summer.rb | Summer.Connection.startup! | def startup!
@started = true
try(:did_start_up)
if config['nickserv_password']
privmsg("identify #{config['nickserv_password']}", "nickserv")
# Wait 10 seconds for nickserv to get back to us.
Thread.new do
sleep(10)
finalize_startup
end
else
... | ruby | def startup!
@started = true
try(:did_start_up)
if config['nickserv_password']
privmsg("identify #{config['nickserv_password']}", "nickserv")
# Wait 10 seconds for nickserv to get back to us.
Thread.new do
sleep(10)
finalize_startup
end
else
... | [
"def",
"startup!",
"@started",
"=",
"true",
"try",
"(",
":did_start_up",
")",
"if",
"config",
"[",
"'nickserv_password'",
"]",
"privmsg",
"(",
"\"identify #{config['nickserv_password']}\"",
",",
"\"nickserv\"",
")",
"# Wait 10 seconds for nickserv to get back to us.",
"Thre... | Will join channels specified in configuration. | [
"Will",
"join",
"channels",
"specified",
"in",
"configuration",
"."
] | 7c08c6a8b2e986030db3718ca71daf2ca8dd668d | https://github.com/radar/summer/blob/7c08c6a8b2e986030db3718ca71daf2ca8dd668d/lib/summer.rb#L69-L83 |
4,194 | radar/summer | lib/summer.rb | Summer.Connection.parse | def parse(message)
puts "<< #{message.to_s.strip}"
words = message.split(" ")
sender = words[0]
raw = words[1]
channel = words[2]
# Handling pings
if /^PING (.*?)\s$/.match(message)
response("PONG #{$1}")
# Handling raws
elsif /\d+/.match(raw)
send("... | ruby | def parse(message)
puts "<< #{message.to_s.strip}"
words = message.split(" ")
sender = words[0]
raw = words[1]
channel = words[2]
# Handling pings
if /^PING (.*?)\s$/.match(message)
response("PONG #{$1}")
# Handling raws
elsif /\d+/.match(raw)
send("... | [
"def",
"parse",
"(",
"message",
")",
"puts",
"\"<< #{message.to_s.strip}\"",
"words",
"=",
"message",
".",
"split",
"(",
"\" \"",
")",
"sender",
"=",
"words",
"[",
"0",
"]",
"raw",
"=",
"words",
"[",
"1",
"]",
"channel",
"=",
"words",
"[",
"2",
"]",
... | What did they say? | [
"What",
"did",
"they",
"say?"
] | 7c08c6a8b2e986030db3718ca71daf2ca8dd668d | https://github.com/radar/summer/blob/7c08c6a8b2e986030db3718ca71daf2ca8dd668d/lib/summer.rb#L107-L145 |
4,195 | apeiros/swissmatch-location | lib/swissmatch/zipcodes.rb | SwissMatch.ZipCodes.[] | def [](key, add_on=nil)
case key
when /\A(\d{4})(\d\d)\z/
by_code_and_add_on($1.to_i, $2.to_i)
when 100_000..999_999
by_code_and_add_on(*key.divmod(100))
when 0..9999, /\A\d{4}\z/
case add_on
when nil
by_code(key.to_i)
whe... | ruby | def [](key, add_on=nil)
case key
when /\A(\d{4})(\d\d)\z/
by_code_and_add_on($1.to_i, $2.to_i)
when 100_000..999_999
by_code_and_add_on(*key.divmod(100))
when 0..9999, /\A\d{4}\z/
case add_on
when nil
by_code(key.to_i)
whe... | [
"def",
"[]",
"(",
"key",
",",
"add_on",
"=",
"nil",
")",
"case",
"key",
"when",
"/",
"\\A",
"\\d",
"\\d",
"\\d",
"\\z",
"/",
"by_code_and_add_on",
"(",
"$1",
".",
"to_i",
",",
"$2",
".",
"to_i",
")",
"when",
"100_000",
"..",
"999_999",
"by_code_and_a... | A convenience method to get one or many zip codes by code, code and add-on, code and city or just
city.
There are various allowed styles to pass those values.
All numeric values can be passed either as Integer or String.
You can pass the code and add-on as six-digit number, or you can pass the code
as four digit n... | [
"A",
"convenience",
"method",
"to",
"get",
"one",
"or",
"many",
"zip",
"codes",
"by",
"code",
"code",
"and",
"add",
"-",
"on",
"code",
"and",
"city",
"or",
"just",
"city",
".",
"There",
"are",
"various",
"allowed",
"styles",
"to",
"pass",
"those",
"val... | 9d360149f29a3e876a55338833e5e6fe89e3622f | https://github.com/apeiros/swissmatch-location/blob/9d360149f29a3e876a55338833e5e6fe89e3622f/lib/swissmatch/zipcodes.rb#L67-L94 |
4,196 | pboling/csv_pirate | lib/csv_pirate/the_capn.rb | CsvPirate.TheCapn.poop_deck | def poop_deck(brig)
if BRIGANTINE_OPTIONS.include?(brig) && !self.flies.empty?
self.old_csv_dump(brig)
elsif brig.is_a?(String)
"#{self.analemma}#{brig}"
else
"#{self.analemma}#{self.swabbie}#{self.aft}"
end
end | ruby | def poop_deck(brig)
if BRIGANTINE_OPTIONS.include?(brig) && !self.flies.empty?
self.old_csv_dump(brig)
elsif brig.is_a?(String)
"#{self.analemma}#{brig}"
else
"#{self.analemma}#{self.swabbie}#{self.aft}"
end
end | [
"def",
"poop_deck",
"(",
"brig",
")",
"if",
"BRIGANTINE_OPTIONS",
".",
"include?",
"(",
"brig",
")",
"&&",
"!",
"self",
".",
"flies",
".",
"empty?",
"self",
".",
"old_csv_dump",
"(",
"brig",
")",
"elsif",
"brig",
".",
"is_a?",
"(",
"String",
")",
"\"#{... | complete file path | [
"complete",
"file",
"path"
] | 3fb0bde9a49b3894bde45d2668fc258eebd61049 | https://github.com/pboling/csv_pirate/blob/3fb0bde9a49b3894bde45d2668fc258eebd61049/lib/csv_pirate/the_capn.rb#L277-L285 |
4,197 | pboling/csv_pirate | lib/csv_pirate/the_capn.rb | CsvPirate.TheCapn.unfurl | def unfurl
wibbly = self.waggoner == '' ? '' : Regexp.escape(self.waggoner)
timey = self.sand_glass == '' ? '' : '\.\d+'
wimey = self.gibbet == '' ? '' : Regexp.escape(self.gibbet)
Regexp.new("#{wibbly}#{timey}#{wimey}")
end | ruby | def unfurl
wibbly = self.waggoner == '' ? '' : Regexp.escape(self.waggoner)
timey = self.sand_glass == '' ? '' : '\.\d+'
wimey = self.gibbet == '' ? '' : Regexp.escape(self.gibbet)
Regexp.new("#{wibbly}#{timey}#{wimey}")
end | [
"def",
"unfurl",
"wibbly",
"=",
"self",
".",
"waggoner",
"==",
"''",
"?",
"''",
":",
"Regexp",
".",
"escape",
"(",
"self",
".",
"waggoner",
")",
"timey",
"=",
"self",
".",
"sand_glass",
"==",
"''",
"?",
"''",
":",
"'\\.\\d+'",
"wimey",
"=",
"self",
... | Regex for matching dumped CSVs | [
"Regex",
"for",
"matching",
"dumped",
"CSVs"
] | 3fb0bde9a49b3894bde45d2668fc258eebd61049 | https://github.com/pboling/csv_pirate/blob/3fb0bde9a49b3894bde45d2668fc258eebd61049/lib/csv_pirate/the_capn.rb#L432-L437 |
4,198 | pboling/csv_pirate | lib/csv_pirate/the_capn.rb | CsvPirate.TheCapn.binnacle | def binnacle(join_value, humanize = true)
self.booty.map do |compass|
string = compass.is_a?(Hash) ?
self.run_through(compass, join_value) :
compass.is_a?(String) ?
compass :
compass.is_a?(Symbol) ?
compass.to_s :
compass.to_s
... | ruby | def binnacle(join_value, humanize = true)
self.booty.map do |compass|
string = compass.is_a?(Hash) ?
self.run_through(compass, join_value) :
compass.is_a?(String) ?
compass :
compass.is_a?(Symbol) ?
compass.to_s :
compass.to_s
... | [
"def",
"binnacle",
"(",
"join_value",
",",
"humanize",
"=",
"true",
")",
"self",
".",
"booty",
".",
"map",
"do",
"|",
"compass",
"|",
"string",
"=",
"compass",
".",
"is_a?",
"(",
"Hash",
")",
"?",
"self",
".",
"run_through",
"(",
"compass",
",",
"joi... | returns an array of strings for CSV header based on booty | [
"returns",
"an",
"array",
"of",
"strings",
"for",
"CSV",
"header",
"based",
"on",
"booty"
] | 3fb0bde9a49b3894bde45d2668fc258eebd61049 | https://github.com/pboling/csv_pirate/blob/3fb0bde9a49b3894bde45d2668fc258eebd61049/lib/csv_pirate/the_capn.rb#L457-L468 |
4,199 | pboling/csv_pirate | lib/csv_pirate/the_capn.rb | CsvPirate.TheCapn.boatswain | def boatswain
return self.swabbie unless self.swabbie.nil?
highval = 0
self.axe.each do |flotsam|
counter = self.filibuster(flotsam)
highval = ((highval <=> counter) == 1) ? highval : counter
end
".#{highval + 1}"
end | ruby | def boatswain
return self.swabbie unless self.swabbie.nil?
highval = 0
self.axe.each do |flotsam|
counter = self.filibuster(flotsam)
highval = ((highval <=> counter) == 1) ? highval : counter
end
".#{highval + 1}"
end | [
"def",
"boatswain",
"return",
"self",
".",
"swabbie",
"unless",
"self",
".",
"swabbie",
".",
"nil?",
"highval",
"=",
"0",
"self",
".",
"axe",
".",
"each",
"do",
"|",
"flotsam",
"|",
"counter",
"=",
"self",
".",
"filibuster",
"(",
"flotsam",
")",
"highv... | File increment for next CSV to dump | [
"File",
"increment",
"for",
"next",
"CSV",
"to",
"dump"
] | 3fb0bde9a49b3894bde45d2668fc258eebd61049 | https://github.com/pboling/csv_pirate/blob/3fb0bde9a49b3894bde45d2668fc258eebd61049/lib/csv_pirate/the_capn.rb#L517-L525 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.