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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
21,900 | oleganza/btcruby | lib/btcruby/transaction.rb | BTC.Transaction.add_input | def add_input(txin)
raise ArgumentError, "Input is missing" if !txin
if !(txin.transaction == nil || txin.transaction == self)
raise ArgumentError, "Can't add an input to a transaction when it references another transaction" # sanity check
end
txin.transaction = self
txin.index = @... | ruby | def add_input(txin)
raise ArgumentError, "Input is missing" if !txin
if !(txin.transaction == nil || txin.transaction == self)
raise ArgumentError, "Can't add an input to a transaction when it references another transaction" # sanity check
end
txin.transaction = self
txin.index = @... | [
"def",
"add_input",
"(",
"txin",
")",
"raise",
"ArgumentError",
",",
"\"Input is missing\"",
"if",
"!",
"txin",
"if",
"!",
"(",
"txin",
".",
"transaction",
"==",
"nil",
"||",
"txin",
".",
"transaction",
"==",
"self",
")",
"raise",
"ArgumentError",
",",
"\"... | Adds another input to the transaction. | [
"Adds",
"another",
"input",
"to",
"the",
"transaction",
"."
] | 0aa0231a29dfc3c9f7fc54b39686aed10b6d9808 | https://github.com/oleganza/btcruby/blob/0aa0231a29dfc3c9f7fc54b39686aed10b6d9808/lib/btcruby/transaction.rb#L208-L217 |
21,901 | oleganza/btcruby | lib/btcruby/data.rb | BTC.Data.data_from_hex | def data_from_hex(hex_string)
raise ArgumentError, "Hex string is missing" if !hex_string
hex_string = hex_string.strip
data = [hex_string].pack(HEX_PACK_CODE)
if hex_from_data(data) != hex_string.downcase # invalid hex string was detected
raise FormatError, "Hex string is invalid: #{hex... | ruby | def data_from_hex(hex_string)
raise ArgumentError, "Hex string is missing" if !hex_string
hex_string = hex_string.strip
data = [hex_string].pack(HEX_PACK_CODE)
if hex_from_data(data) != hex_string.downcase # invalid hex string was detected
raise FormatError, "Hex string is invalid: #{hex... | [
"def",
"data_from_hex",
"(",
"hex_string",
")",
"raise",
"ArgumentError",
",",
"\"Hex string is missing\"",
"if",
"!",
"hex_string",
"hex_string",
"=",
"hex_string",
".",
"strip",
"data",
"=",
"[",
"hex_string",
"]",
".",
"pack",
"(",
"HEX_PACK_CODE",
")",
"if",... | Converts hexadecimal string to a binary data string. | [
"Converts",
"hexadecimal",
"string",
"to",
"a",
"binary",
"data",
"string",
"."
] | 0aa0231a29dfc3c9f7fc54b39686aed10b6d9808 | https://github.com/oleganza/btcruby/blob/0aa0231a29dfc3c9f7fc54b39686aed10b6d9808/lib/btcruby/data.rb#L22-L30 |
21,902 | oleganza/btcruby | lib/btcruby/openssl.rb | BTC.OpenSSL.regenerate_keypair | def regenerate_keypair(private_key, public_key_compressed: false)
autorelease do |pool|
eckey = pool.new_ec_key
priv_bn = pool.new_bn(private_key)
pub_key = pool.new_ec_point
EC_POINT_mul(self.group, pub_key, priv_bn, nil, nil, pool.bn_ctx)
EC_KEY_set_private_key(eckey,... | ruby | def regenerate_keypair(private_key, public_key_compressed: false)
autorelease do |pool|
eckey = pool.new_ec_key
priv_bn = pool.new_bn(private_key)
pub_key = pool.new_ec_point
EC_POINT_mul(self.group, pub_key, priv_bn, nil, nil, pool.bn_ctx)
EC_KEY_set_private_key(eckey,... | [
"def",
"regenerate_keypair",
"(",
"private_key",
",",
"public_key_compressed",
":",
"false",
")",
"autorelease",
"do",
"|",
"pool",
"|",
"eckey",
"=",
"pool",
".",
"new_ec_key",
"priv_bn",
"=",
"pool",
".",
"new_bn",
"(",
"private_key",
")",
"pub_key",
"=",
... | Returns a pair of private key, public key | [
"Returns",
"a",
"pair",
"of",
"private",
"key",
"public",
"key"
] | 0aa0231a29dfc3c9f7fc54b39686aed10b6d9808 | https://github.com/oleganza/btcruby/blob/0aa0231a29dfc3c9f7fc54b39686aed10b6d9808/lib/btcruby/openssl.rb#L174-L214 |
21,903 | oleganza/btcruby | lib/btcruby/openssl.rb | BTC.OpenSSL.private_key_from_der_format | def private_key_from_der_format(der_key)
raise ArgumentError, "Missing DER private key" if !der_key
prepare_if_needed
buf = FFI::MemoryPointer.from_string(der_key)
ec_key = d2i_ECPrivateKey(nil, pointer_to_pointer(buf), buf.size-1)
if ec_key.null?
raise BTCError, "OpenSSL failed ... | ruby | def private_key_from_der_format(der_key)
raise ArgumentError, "Missing DER private key" if !der_key
prepare_if_needed
buf = FFI::MemoryPointer.from_string(der_key)
ec_key = d2i_ECPrivateKey(nil, pointer_to_pointer(buf), buf.size-1)
if ec_key.null?
raise BTCError, "OpenSSL failed ... | [
"def",
"private_key_from_der_format",
"(",
"der_key",
")",
"raise",
"ArgumentError",
",",
"\"Missing DER private key\"",
"if",
"!",
"der_key",
"prepare_if_needed",
"buf",
"=",
"FFI",
"::",
"MemoryPointer",
".",
"from_string",
"(",
"der_key",
")",
"ec_key",
"=",
"d2i... | extract private key from uncompressed DER format | [
"extract",
"private",
"key",
"from",
"uncompressed",
"DER",
"format"
] | 0aa0231a29dfc3c9f7fc54b39686aed10b6d9808 | https://github.com/oleganza/btcruby/blob/0aa0231a29dfc3c9f7fc54b39686aed10b6d9808/lib/btcruby/openssl.rb#L440-L453 |
21,904 | oleganza/btcruby | lib/btcruby/openssl.rb | BTC.OpenSSL.data_from_bn | def data_from_bn(bn, min_length: nil, required_length: nil)
raise ArgumentError, "Missing big number" if !bn
length = BN_num_bytes(bn)
buf = FFI::MemoryPointer.from_string("\x00"*length)
BN_bn2bin(bn, buf)
s = buf.read_string(length)
s = s.rjust(min_length, "\x00") if min_length
... | ruby | def data_from_bn(bn, min_length: nil, required_length: nil)
raise ArgumentError, "Missing big number" if !bn
length = BN_num_bytes(bn)
buf = FFI::MemoryPointer.from_string("\x00"*length)
BN_bn2bin(bn, buf)
s = buf.read_string(length)
s = s.rjust(min_length, "\x00") if min_length
... | [
"def",
"data_from_bn",
"(",
"bn",
",",
"min_length",
":",
"nil",
",",
"required_length",
":",
"nil",
")",
"raise",
"ArgumentError",
",",
"\"Missing big number\"",
"if",
"!",
"bn",
"length",
"=",
"BN_num_bytes",
"(",
"bn",
")",
"buf",
"=",
"FFI",
"::",
"Mem... | Returns data from bignum | [
"Returns",
"data",
"from",
"bignum"
] | 0aa0231a29dfc3c9f7fc54b39686aed10b6d9808 | https://github.com/oleganza/btcruby/blob/0aa0231a29dfc3c9f7fc54b39686aed10b6d9808/lib/btcruby/openssl.rb#L456-L468 |
21,905 | oleganza/btcruby | lib/btcruby/wire_format.rb | BTC.WireFormat.encode_varint | def encode_varint(i)
raise ArgumentError, "int must be present" if !i
raise ArgumentError, "int must be non-negative" if i < 0
buf = if i < 0xfd
[i].pack("C")
elsif i <= 0xffff
[0xfd, i].pack("Cv")
elsif i <= 0xffffffff
[0xfe, i].pack("CV")
elsif i <= 0xffff... | ruby | def encode_varint(i)
raise ArgumentError, "int must be present" if !i
raise ArgumentError, "int must be non-negative" if i < 0
buf = if i < 0xfd
[i].pack("C")
elsif i <= 0xffff
[0xfd, i].pack("Cv")
elsif i <= 0xffffffff
[0xfe, i].pack("CV")
elsif i <= 0xffff... | [
"def",
"encode_varint",
"(",
"i",
")",
"raise",
"ArgumentError",
",",
"\"int must be present\"",
"if",
"!",
"i",
"raise",
"ArgumentError",
",",
"\"int must be non-negative\"",
"if",
"i",
"<",
"0",
"buf",
"=",
"if",
"i",
"<",
"0xfd",
"[",
"i",
"]",
".",
"pa... | read_varint
Encodes integer and returns its binary varint representation. | [
"read_varint",
"Encodes",
"integer",
"and",
"returns",
"its",
"binary",
"varint",
"representation",
"."
] | 0aa0231a29dfc3c9f7fc54b39686aed10b6d9808 | https://github.com/oleganza/btcruby/blob/0aa0231a29dfc3c9f7fc54b39686aed10b6d9808/lib/btcruby/wire_format.rb#L101-L118 |
21,906 | oleganza/btcruby | lib/btcruby/wire_format.rb | BTC.WireFormat.write_varint | def write_varint(i, data: nil, stream: nil)
buf = encode_varint(i)
data << buf if data
stream.write(buf) if stream
buf
end | ruby | def write_varint(i, data: nil, stream: nil)
buf = encode_varint(i)
data << buf if data
stream.write(buf) if stream
buf
end | [
"def",
"write_varint",
"(",
"i",
",",
"data",
":",
"nil",
",",
"stream",
":",
"nil",
")",
"buf",
"=",
"encode_varint",
"(",
"i",
")",
"data",
"<<",
"buf",
"if",
"data",
"stream",
".",
"write",
"(",
"buf",
")",
"if",
"stream",
"buf",
"end"
] | Encodes integer and returns its binary varint representation.
If data is given, appends to a data.
If stream is given, writes to a stream. | [
"Encodes",
"integer",
"and",
"returns",
"its",
"binary",
"varint",
"representation",
".",
"If",
"data",
"is",
"given",
"appends",
"to",
"a",
"data",
".",
"If",
"stream",
"is",
"given",
"writes",
"to",
"a",
"stream",
"."
] | 0aa0231a29dfc3c9f7fc54b39686aed10b6d9808 | https://github.com/oleganza/btcruby/blob/0aa0231a29dfc3c9f7fc54b39686aed10b6d9808/lib/btcruby/wire_format.rb#L123-L128 |
21,907 | oleganza/btcruby | lib/btcruby/wire_format.rb | BTC.WireFormat.encode_string | def encode_string(string)
raise ArgumentError, "String must be present" if !string
encode_varint(string.bytesize) + BTC::Data.ensure_binary_encoding(string)
end | ruby | def encode_string(string)
raise ArgumentError, "String must be present" if !string
encode_varint(string.bytesize) + BTC::Data.ensure_binary_encoding(string)
end | [
"def",
"encode_string",
"(",
"string",
")",
"raise",
"ArgumentError",
",",
"\"String must be present\"",
"if",
"!",
"string",
"encode_varint",
"(",
"string",
".",
"bytesize",
")",
"+",
"BTC",
"::",
"Data",
".",
"ensure_binary_encoding",
"(",
"string",
")",
"end"... | Returns the binary representation of the var-length string. | [
"Returns",
"the",
"binary",
"representation",
"of",
"the",
"var",
"-",
"length",
"string",
"."
] | 0aa0231a29dfc3c9f7fc54b39686aed10b6d9808 | https://github.com/oleganza/btcruby/blob/0aa0231a29dfc3c9f7fc54b39686aed10b6d9808/lib/btcruby/wire_format.rb#L166-L169 |
21,908 | oleganza/btcruby | lib/btcruby/wire_format.rb | BTC.WireFormat.write_string | def write_string(string, data: nil, stream: nil)
raise ArgumentError, "String must be present" if !string
intbuf = write_varint(string.bytesize, data: data, stream: stream)
stringbuf = BTC::Data.ensure_binary_encoding(string)
data << stringbuf if data
stream.write(stringbuf) if stream
... | ruby | def write_string(string, data: nil, stream: nil)
raise ArgumentError, "String must be present" if !string
intbuf = write_varint(string.bytesize, data: data, stream: stream)
stringbuf = BTC::Data.ensure_binary_encoding(string)
data << stringbuf if data
stream.write(stringbuf) if stream
... | [
"def",
"write_string",
"(",
"string",
",",
"data",
":",
"nil",
",",
"stream",
":",
"nil",
")",
"raise",
"ArgumentError",
",",
"\"String must be present\"",
"if",
"!",
"string",
"intbuf",
"=",
"write_varint",
"(",
"string",
".",
"bytesize",
",",
"data",
":",
... | Writes variable-length string to a data buffer or IO stream.
If data is given, appends to a data.
If stream is given, writes to a stream.
Returns the binary representation of the var-length string. | [
"Writes",
"variable",
"-",
"length",
"string",
"to",
"a",
"data",
"buffer",
"or",
"IO",
"stream",
".",
"If",
"data",
"is",
"given",
"appends",
"to",
"a",
"data",
".",
"If",
"stream",
"is",
"given",
"writes",
"to",
"a",
"stream",
".",
"Returns",
"the",
... | 0aa0231a29dfc3c9f7fc54b39686aed10b6d9808 | https://github.com/oleganza/btcruby/blob/0aa0231a29dfc3c9f7fc54b39686aed10b6d9808/lib/btcruby/wire_format.rb#L175-L186 |
21,909 | oleganza/btcruby | lib/btcruby/wire_format.rb | BTC.WireFormat.read_array | def read_array(data: nil, stream: nil, offset: 0)
count, len = read_varint(data: data, stream: stream, offset: offset)
return [nil, len] if !count
(0...count).map do |i|
yield
end
end | ruby | def read_array(data: nil, stream: nil, offset: 0)
count, len = read_varint(data: data, stream: stream, offset: offset)
return [nil, len] if !count
(0...count).map do |i|
yield
end
end | [
"def",
"read_array",
"(",
"data",
":",
"nil",
",",
"stream",
":",
"nil",
",",
"offset",
":",
"0",
")",
"count",
",",
"len",
"=",
"read_varint",
"(",
"data",
":",
"data",
",",
"stream",
":",
"stream",
",",
"offset",
":",
"offset",
")",
"return",
"["... | Reads varint length prefix, then calls the block appropriate number of times to read the items.
Returns an array of items. | [
"Reads",
"varint",
"length",
"prefix",
"then",
"calls",
"the",
"block",
"appropriate",
"number",
"of",
"times",
"to",
"read",
"the",
"items",
".",
"Returns",
"an",
"array",
"of",
"items",
"."
] | 0aa0231a29dfc3c9f7fc54b39686aed10b6d9808 | https://github.com/oleganza/btcruby/blob/0aa0231a29dfc3c9f7fc54b39686aed10b6d9808/lib/btcruby/wire_format.rb#L191-L197 |
21,910 | oleganza/btcruby | lib/btcruby/wire_format.rb | BTC.WireFormat.encode_uleb128 | def encode_uleb128(value)
raise ArgumentError, "Signed integers are not supported" if value < 0
return "\x00" if value == 0
bytes = []
while value != 0
byte = value & 0b01111111 # 0x7f
value >>= 7
if value != 0
byte |= 0b10000000 # 0x80
end
bytes... | ruby | def encode_uleb128(value)
raise ArgumentError, "Signed integers are not supported" if value < 0
return "\x00" if value == 0
bytes = []
while value != 0
byte = value & 0b01111111 # 0x7f
value >>= 7
if value != 0
byte |= 0b10000000 # 0x80
end
bytes... | [
"def",
"encode_uleb128",
"(",
"value",
")",
"raise",
"ArgumentError",
",",
"\"Signed integers are not supported\"",
"if",
"value",
"<",
"0",
"return",
"\"\\x00\"",
"if",
"value",
"==",
"0",
"bytes",
"=",
"[",
"]",
"while",
"value",
"!=",
"0",
"byte",
"=",
"v... | Encodes an unsigned integer using LEB128. | [
"Encodes",
"an",
"unsigned",
"integer",
"using",
"LEB128",
"."
] | 0aa0231a29dfc3c9f7fc54b39686aed10b6d9808 | https://github.com/oleganza/btcruby/blob/0aa0231a29dfc3c9f7fc54b39686aed10b6d9808/lib/btcruby/wire_format.rb#L263-L276 |
21,911 | oleganza/btcruby | lib/btcruby/wire_format.rb | BTC.WireFormat.write_uleb128 | def write_uleb128(value, data: nil, stream: nil)
raise ArgumentError, "Integer must be present" if !value
buf = encode_uleb128(value)
data << buf if data
stream.write(buf) if stream
buf
end | ruby | def write_uleb128(value, data: nil, stream: nil)
raise ArgumentError, "Integer must be present" if !value
buf = encode_uleb128(value)
data << buf if data
stream.write(buf) if stream
buf
end | [
"def",
"write_uleb128",
"(",
"value",
",",
"data",
":",
"nil",
",",
"stream",
":",
"nil",
")",
"raise",
"ArgumentError",
",",
"\"Integer must be present\"",
"if",
"!",
"value",
"buf",
"=",
"encode_uleb128",
"(",
"value",
")",
"data",
"<<",
"buf",
"if",
"da... | Writes an unsigned integer encoded in LEB128 to a data buffer or a stream.
Returns LEB128-encoded binary string. | [
"Writes",
"an",
"unsigned",
"integer",
"encoded",
"in",
"LEB128",
"to",
"a",
"data",
"buffer",
"or",
"a",
"stream",
".",
"Returns",
"LEB128",
"-",
"encoded",
"binary",
"string",
"."
] | 0aa0231a29dfc3c9f7fc54b39686aed10b6d9808 | https://github.com/oleganza/btcruby/blob/0aa0231a29dfc3c9f7fc54b39686aed10b6d9808/lib/btcruby/wire_format.rb#L280-L286 |
21,912 | pluginaweek/preferences | lib/preferences.rb | Preferences.InstanceMethods.preferences | def preferences(group = nil)
preferences = preferences_group(group)
unless preferences_group_loaded?(group)
group_id, group_type = Preference.split_group(group)
find_preferences(:group_id => group_id, :group_type => group_type).each do |preference|
preferences[preference.nam... | ruby | def preferences(group = nil)
preferences = preferences_group(group)
unless preferences_group_loaded?(group)
group_id, group_type = Preference.split_group(group)
find_preferences(:group_id => group_id, :group_type => group_type).each do |preference|
preferences[preference.nam... | [
"def",
"preferences",
"(",
"group",
"=",
"nil",
")",
"preferences",
"=",
"preferences_group",
"(",
"group",
")",
"unless",
"preferences_group_loaded?",
"(",
"group",
")",
"group_id",
",",
"group_type",
"=",
"Preference",
".",
"split_group",
"(",
"group",
")",
... | Finds all preferences, including defaults, for the current record. If
looking up custom group preferences, then this will include all default
preferences within that particular group as well.
== Examples
A user with no stored values:
user = User.find(:first)
user.preferences
=> {"language"=>"English", ... | [
"Finds",
"all",
"preferences",
"including",
"defaults",
"for",
"the",
"current",
"record",
".",
"If",
"looking",
"up",
"custom",
"group",
"preferences",
"then",
"this",
"will",
"include",
"all",
"default",
"preferences",
"within",
"that",
"particular",
"group",
... | 949894e579eb705e208c70af05179c16a65fd406 | https://github.com/pluginaweek/preferences/blob/949894e579eb705e208c70af05179c16a65fd406/lib/preferences.rb#L305-L324 |
21,913 | pluginaweek/preferences | lib/preferences.rb | Preferences.InstanceMethods.preferred? | def preferred?(name, group = nil)
name = name.to_s
assert_valid_preference(name)
value = preferred(name, group)
preference_definitions[name].query(value)
end | ruby | def preferred?(name, group = nil)
name = name.to_s
assert_valid_preference(name)
value = preferred(name, group)
preference_definitions[name].query(value)
end | [
"def",
"preferred?",
"(",
"name",
",",
"group",
"=",
"nil",
")",
"name",
"=",
"name",
".",
"to_s",
"assert_valid_preference",
"(",
"name",
")",
"value",
"=",
"preferred",
"(",
"name",
",",
"group",
")",
"preference_definitions",
"[",
"name",
"]",
".",
"q... | Queries whether or not a value is present for the given preference.
This is dependent on how the value is type-casted.
== Examples
class User < ActiveRecord::Base
preference :color, :string, :default => 'red'
end
user = User.create
user.preferred(:color) # => "red"
user.preferred?(... | [
"Queries",
"whether",
"or",
"not",
"a",
"value",
"is",
"present",
"for",
"the",
"given",
"preference",
".",
"This",
"is",
"dependent",
"on",
"how",
"the",
"value",
"is",
"type",
"-",
"casted",
"."
] | 949894e579eb705e208c70af05179c16a65fd406 | https://github.com/pluginaweek/preferences/blob/949894e579eb705e208c70af05179c16a65fd406/lib/preferences.rb#L344-L350 |
21,914 | pluginaweek/preferences | lib/preferences.rb | Preferences.InstanceMethods.preferred | def preferred(name, group = nil)
name = name.to_s
assert_valid_preference(name)
if preferences_group(group).include?(name)
# Value for this group/name has been written, but not saved yet:
# grab from the pending values
value = preferences_group(group)[name]
else
... | ruby | def preferred(name, group = nil)
name = name.to_s
assert_valid_preference(name)
if preferences_group(group).include?(name)
# Value for this group/name has been written, but not saved yet:
# grab from the pending values
value = preferences_group(group)[name]
else
... | [
"def",
"preferred",
"(",
"name",
",",
"group",
"=",
"nil",
")",
"name",
"=",
"name",
".",
"to_s",
"assert_valid_preference",
"(",
"name",
")",
"if",
"preferences_group",
"(",
"group",
")",
".",
"include?",
"(",
"name",
")",
"# Value for this group/name has bee... | Gets the actual value stored for the given preference, or the default
value if nothing is present.
== Examples
class User < ActiveRecord::Base
preference :color, :string, :default => 'red'
end
user = User.create
user.preferred(:color) # => "red"
user.preferred(:color, 'cars') # =>... | [
"Gets",
"the",
"actual",
"value",
"stored",
"for",
"the",
"given",
"preference",
"or",
"the",
"default",
"value",
"if",
"nothing",
"is",
"present",
"."
] | 949894e579eb705e208c70af05179c16a65fd406 | https://github.com/pluginaweek/preferences/blob/949894e579eb705e208c70af05179c16a65fd406/lib/preferences.rb#L369-L389 |
21,915 | pluginaweek/preferences | lib/preferences.rb | Preferences.InstanceMethods.preference_changes | def preference_changes(group = nil)
preferences_changed(group).inject({}) do |changes, preference|
changes[preference] = preference_change(preference, group)
changes
end
end | ruby | def preference_changes(group = nil)
preferences_changed(group).inject({}) do |changes, preference|
changes[preference] = preference_change(preference, group)
changes
end
end | [
"def",
"preference_changes",
"(",
"group",
"=",
"nil",
")",
"preferences_changed",
"(",
"group",
")",
".",
"inject",
"(",
"{",
"}",
")",
"do",
"|",
"changes",
",",
"preference",
"|",
"changes",
"[",
"preference",
"]",
"=",
"preference_change",
"(",
"prefer... | A map of the preferences that have changed in the current object.
== Examples
user = User.find(:first)
user.preferred(:color) # => nil
user.preference_changes # => {}
user.write_preference(:color, 'red')
user.preference_changes # => {"color... | [
"A",
"map",
"of",
"the",
"preferences",
"that",
"have",
"changed",
"in",
"the",
"current",
"object",
"."
] | 949894e579eb705e208c70af05179c16a65fd406 | https://github.com/pluginaweek/preferences/blob/949894e579eb705e208c70af05179c16a65fd406/lib/preferences.rb#L481-L486 |
21,916 | pluginaweek/preferences | lib/preferences.rb | Preferences.InstanceMethods.preference_was | def preference_was(name, group)
preference_changed?(name, group) ? preferences_changed_group(group)[name] : preferred(name, group)
end | ruby | def preference_was(name, group)
preference_changed?(name, group) ? preferences_changed_group(group)[name] : preferred(name, group)
end | [
"def",
"preference_was",
"(",
"name",
",",
"group",
")",
"preference_changed?",
"(",
"name",
",",
"group",
")",
"?",
"preferences_changed_group",
"(",
"group",
")",
"[",
"name",
"]",
":",
"preferred",
"(",
"name",
",",
"group",
")",
"end"
] | Gets the last saved value for the given preference | [
"Gets",
"the",
"last",
"saved",
"value",
"for",
"the",
"given",
"preference"
] | 949894e579eb705e208c70af05179c16a65fd406 | https://github.com/pluginaweek/preferences/blob/949894e579eb705e208c70af05179c16a65fd406/lib/preferences.rb#L545-L547 |
21,917 | pluginaweek/preferences | lib/preferences.rb | Preferences.InstanceMethods.reset_preference! | def reset_preference!(name, group)
write_preference(name, preferences_changed_group(group)[name], group) if preference_changed?(name, group)
end | ruby | def reset_preference!(name, group)
write_preference(name, preferences_changed_group(group)[name], group) if preference_changed?(name, group)
end | [
"def",
"reset_preference!",
"(",
"name",
",",
"group",
")",
"write_preference",
"(",
"name",
",",
"preferences_changed_group",
"(",
"group",
")",
"[",
"name",
"]",
",",
"group",
")",
"if",
"preference_changed?",
"(",
"name",
",",
"group",
")",
"end"
] | Reverts any unsaved changes to the given preference | [
"Reverts",
"any",
"unsaved",
"changes",
"to",
"the",
"given",
"preference"
] | 949894e579eb705e208c70af05179c16a65fd406 | https://github.com/pluginaweek/preferences/blob/949894e579eb705e208c70af05179c16a65fd406/lib/preferences.rb#L556-L558 |
21,918 | pluginaweek/preferences | lib/preferences.rb | Preferences.InstanceMethods.preference_value_changed? | def preference_value_changed?(name, old, value)
definition = preference_definitions[name]
if definition.type == :integer && (old.nil? || old == 0)
# For nullable numeric columns, NULL gets stored in database for blank (i.e. '') values.
# Hence we don't record it as a change if the va... | ruby | def preference_value_changed?(name, old, value)
definition = preference_definitions[name]
if definition.type == :integer && (old.nil? || old == 0)
# For nullable numeric columns, NULL gets stored in database for blank (i.e. '') values.
# Hence we don't record it as a change if the va... | [
"def",
"preference_value_changed?",
"(",
"name",
",",
"old",
",",
"value",
")",
"definition",
"=",
"preference_definitions",
"[",
"name",
"]",
"if",
"definition",
".",
"type",
"==",
":integer",
"&&",
"(",
"old",
".",
"nil?",
"||",
"old",
"==",
"0",
")",
... | Determines whether the old value is different from the new value for the
given preference. This will use the typecasted value to determine
equality. | [
"Determines",
"whether",
"the",
"old",
"value",
"is",
"different",
"from",
"the",
"new",
"value",
"for",
"the",
"given",
"preference",
".",
"This",
"will",
"use",
"the",
"typecasted",
"value",
"to",
"determine",
"equality",
"."
] | 949894e579eb705e208c70af05179c16a65fd406 | https://github.com/pluginaweek/preferences/blob/949894e579eb705e208c70af05179c16a65fd406/lib/preferences.rb#L563-L576 |
21,919 | pluginaweek/preferences | lib/preferences.rb | Preferences.InstanceMethods.find_preferences | def find_preferences(attributes)
if stored_preferences.loaded?
stored_preferences.select do |preference|
attributes.all? {|attribute, value| preference[attribute] == value}
end
else
stored_preferences.find(:all, :conditions => attributes)
end
end | ruby | def find_preferences(attributes)
if stored_preferences.loaded?
stored_preferences.select do |preference|
attributes.all? {|attribute, value| preference[attribute] == value}
end
else
stored_preferences.find(:all, :conditions => attributes)
end
end | [
"def",
"find_preferences",
"(",
"attributes",
")",
"if",
"stored_preferences",
".",
"loaded?",
"stored_preferences",
".",
"select",
"do",
"|",
"preference",
"|",
"attributes",
".",
"all?",
"{",
"|",
"attribute",
",",
"value",
"|",
"preference",
"[",
"attribute",... | Finds all stored preferences with the given attributes. This will do a
smart lookup by looking at the in-memory collection if it was eager-
loaded. | [
"Finds",
"all",
"stored",
"preferences",
"with",
"the",
"given",
"attributes",
".",
"This",
"will",
"do",
"a",
"smart",
"lookup",
"by",
"looking",
"at",
"the",
"in",
"-",
"memory",
"collection",
"if",
"it",
"was",
"eager",
"-",
"loaded",
"."
] | 949894e579eb705e208c70af05179c16a65fd406 | https://github.com/pluginaweek/preferences/blob/949894e579eb705e208c70af05179c16a65fd406/lib/preferences.rb#L601-L609 |
21,920 | mvidner/ruby-dbus | lib/dbus/proxy_object.rb | DBus.ProxyObject.[] | def [](intfname)
introspect unless introspected
ifc = @interfaces[intfname]
raise DBus::Error, "no such interface `#{intfname}' on object `#{@path}'" unless ifc
ifc
end | ruby | def [](intfname)
introspect unless introspected
ifc = @interfaces[intfname]
raise DBus::Error, "no such interface `#{intfname}' on object `#{@path}'" unless ifc
ifc
end | [
"def",
"[]",
"(",
"intfname",
")",
"introspect",
"unless",
"introspected",
"ifc",
"=",
"@interfaces",
"[",
"intfname",
"]",
"raise",
"DBus",
"::",
"Error",
",",
"\"no such interface `#{intfname}' on object `#{@path}'\"",
"unless",
"ifc",
"ifc",
"end"
] | Retrieves an interface of the proxy object
@param [String] intfname
@return [ProxyObjectInterface] | [
"Retrieves",
"an",
"interface",
"of",
"the",
"proxy",
"object"
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/proxy_object.rb#L55-L60 |
21,921 | mvidner/ruby-dbus | lib/dbus/proxy_object_interface.rb | DBus.ProxyObjectInterface.define_method_from_descriptor | def define_method_from_descriptor(m)
m.params.each do |fpar|
par = fpar.type
# This is the signature validity check
Type::Parser.new(par).parse
end
singleton_class.class_eval do
define_method m.name do |*args, &reply_handler|
if m.params.size != args.size
... | ruby | def define_method_from_descriptor(m)
m.params.each do |fpar|
par = fpar.type
# This is the signature validity check
Type::Parser.new(par).parse
end
singleton_class.class_eval do
define_method m.name do |*args, &reply_handler|
if m.params.size != args.size
... | [
"def",
"define_method_from_descriptor",
"(",
"m",
")",
"m",
".",
"params",
".",
"each",
"do",
"|",
"fpar",
"|",
"par",
"=",
"fpar",
".",
"type",
"# This is the signature validity check",
"Type",
"::",
"Parser",
".",
"new",
"(",
"par",
")",
".",
"parse",
"e... | Defines a method on the interface from the Method descriptor _m_. | [
"Defines",
"a",
"method",
"on",
"the",
"interface",
"from",
"the",
"Method",
"descriptor",
"_m_",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/proxy_object_interface.rb#L40-L73 |
21,922 | mvidner/ruby-dbus | lib/dbus/proxy_object_interface.rb | DBus.ProxyObjectInterface.define | def define(m)
if m.is_a?(Method)
define_method_from_descriptor(m)
elsif m.is_a?(Signal)
define_signal_from_descriptor(m)
end
end | ruby | def define(m)
if m.is_a?(Method)
define_method_from_descriptor(m)
elsif m.is_a?(Signal)
define_signal_from_descriptor(m)
end
end | [
"def",
"define",
"(",
"m",
")",
"if",
"m",
".",
"is_a?",
"(",
"Method",
")",
"define_method_from_descriptor",
"(",
"m",
")",
"elsif",
"m",
".",
"is_a?",
"(",
"Signal",
")",
"define_signal_from_descriptor",
"(",
"m",
")",
"end",
"end"
] | Defines a signal or method based on the descriptor _m_. | [
"Defines",
"a",
"signal",
"or",
"method",
"based",
"on",
"the",
"descriptor",
"_m_",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/proxy_object_interface.rb#L81-L87 |
21,923 | mvidner/ruby-dbus | lib/dbus/proxy_object_interface.rb | DBus.ProxyObjectInterface.define_method | def define_method(methodname, prototype)
m = Method.new(methodname)
m.from_prototype(prototype)
define(m)
end | ruby | def define_method(methodname, prototype)
m = Method.new(methodname)
m.from_prototype(prototype)
define(m)
end | [
"def",
"define_method",
"(",
"methodname",
",",
"prototype",
")",
"m",
"=",
"Method",
".",
"new",
"(",
"methodname",
")",
"m",
".",
"from_prototype",
"(",
"prototype",
")",
"define",
"(",
"m",
")",
"end"
] | Defines a proxied method on the interface. | [
"Defines",
"a",
"proxied",
"method",
"on",
"the",
"interface",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/proxy_object_interface.rb#L90-L94 |
21,924 | mvidner/ruby-dbus | lib/dbus/proxy_object_interface.rb | DBus.ProxyObjectInterface.[] | def [](propname)
ret = object[PROPERTY_INTERFACE].Get(name, propname)
# this method always returns the single property
if @object.api.proxy_method_returns_array
ret[0]
else
ret
end
end | ruby | def [](propname)
ret = object[PROPERTY_INTERFACE].Get(name, propname)
# this method always returns the single property
if @object.api.proxy_method_returns_array
ret[0]
else
ret
end
end | [
"def",
"[]",
"(",
"propname",
")",
"ret",
"=",
"object",
"[",
"PROPERTY_INTERFACE",
"]",
".",
"Get",
"(",
"name",
",",
"propname",
")",
"# this method always returns the single property",
"if",
"@object",
".",
"api",
".",
"proxy_method_returns_array",
"ret",
"[",
... | Read a property.
@param propname [String] | [
"Read",
"a",
"property",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/proxy_object_interface.rb#L116-L124 |
21,925 | mvidner/ruby-dbus | lib/dbus/proxy_object_interface.rb | DBus.ProxyObjectInterface.all_properties | def all_properties
ret = object[PROPERTY_INTERFACE].GetAll(name)
# this method always returns the single property
if @object.api.proxy_method_returns_array
ret[0]
else
ret
end
end | ruby | def all_properties
ret = object[PROPERTY_INTERFACE].GetAll(name)
# this method always returns the single property
if @object.api.proxy_method_returns_array
ret[0]
else
ret
end
end | [
"def",
"all_properties",
"ret",
"=",
"object",
"[",
"PROPERTY_INTERFACE",
"]",
".",
"GetAll",
"(",
"name",
")",
"# this method always returns the single property",
"if",
"@object",
".",
"api",
".",
"proxy_method_returns_array",
"ret",
"[",
"0",
"]",
"else",
"ret",
... | Read all properties at once, as a hash.
@return [Hash{String}] | [
"Read",
"all",
"properties",
"at",
"once",
"as",
"a",
"hash",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/proxy_object_interface.rb#L135-L143 |
21,926 | mvidner/ruby-dbus | lib/dbus/message_queue.rb | DBus.MessageQueue.connect | def connect
addresses = @address.split ";"
# connect to first one that succeeds
worked = addresses.find do |a|
transport, keyvaluestring = a.split ":"
kv_list = keyvaluestring.split ","
kv_hash = {}
kv_list.each do |kv|
key, escaped_value = kv.split "="
... | ruby | def connect
addresses = @address.split ";"
# connect to first one that succeeds
worked = addresses.find do |a|
transport, keyvaluestring = a.split ":"
kv_list = keyvaluestring.split ","
kv_hash = {}
kv_list.each do |kv|
key, escaped_value = kv.split "="
... | [
"def",
"connect",
"addresses",
"=",
"@address",
".",
"split",
"\";\"",
"# connect to first one that succeeds",
"worked",
"=",
"addresses",
".",
"find",
"do",
"|",
"a",
"|",
"transport",
",",
"keyvaluestring",
"=",
"a",
".",
"split",
"\":\"",
"kv_list",
"=",
"k... | Connect to the bus and initialize the connection. | [
"Connect",
"to",
"the",
"bus",
"and",
"initialize",
"the",
"connection",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/message_queue.rb#L53-L79 |
21,927 | mvidner/ruby-dbus | lib/dbus/message_queue.rb | DBus.MessageQueue.connect_to_tcp | def connect_to_tcp(params)
# check if the path is sufficient
if params.key?("host") && params.key?("port")
begin
# initialize the tcp socket
@socket = TCPSocket.new(params["host"], params["port"].to_i)
@socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
init_conn... | ruby | def connect_to_tcp(params)
# check if the path is sufficient
if params.key?("host") && params.key?("port")
begin
# initialize the tcp socket
@socket = TCPSocket.new(params["host"], params["port"].to_i)
@socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
init_conn... | [
"def",
"connect_to_tcp",
"(",
"params",
")",
"# check if the path is sufficient",
"if",
"params",
".",
"key?",
"(",
"\"host\"",
")",
"&&",
"params",
".",
"key?",
"(",
"\"port\"",
")",
"begin",
"# initialize the tcp socket",
"@socket",
"=",
"TCPSocket",
".",
"new",... | Connect to a bus over tcp and initialize the connection. | [
"Connect",
"to",
"a",
"bus",
"over",
"tcp",
"and",
"initialize",
"the",
"connection",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/message_queue.rb#L82-L100 |
21,928 | mvidner/ruby-dbus | lib/dbus/message_queue.rb | DBus.MessageQueue.connect_to_unix | def connect_to_unix(params)
@socket = Socket.new(Socket::Constants::PF_UNIX, Socket::Constants::SOCK_STREAM, 0)
@socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
if !params["abstract"].nil?
sockaddr = if HOST_END == LIL_END
"\1\0\0#{params["abstract"]}"
e... | ruby | def connect_to_unix(params)
@socket = Socket.new(Socket::Constants::PF_UNIX, Socket::Constants::SOCK_STREAM, 0)
@socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
if !params["abstract"].nil?
sockaddr = if HOST_END == LIL_END
"\1\0\0#{params["abstract"]}"
e... | [
"def",
"connect_to_unix",
"(",
"params",
")",
"@socket",
"=",
"Socket",
".",
"new",
"(",
"Socket",
"::",
"Constants",
"::",
"PF_UNIX",
",",
"Socket",
"::",
"Constants",
"::",
"SOCK_STREAM",
",",
"0",
")",
"@socket",
".",
"fcntl",
"(",
"Fcntl",
"::",
"F_S... | Connect to an abstract unix bus and initialize the connection. | [
"Connect",
"to",
"an",
"abstract",
"unix",
"bus",
"and",
"initialize",
"the",
"connection",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/message_queue.rb#L103-L117 |
21,929 | mvidner/ruby-dbus | lib/dbus/message.rb | DBus.Message.add_param | def add_param(type, val)
type = type.chr if type.is_a?(Integer)
@signature += type.to_s
@params << [type, val]
end | ruby | def add_param(type, val)
type = type.chr if type.is_a?(Integer)
@signature += type.to_s
@params << [type, val]
end | [
"def",
"add_param",
"(",
"type",
",",
"val",
")",
"type",
"=",
"type",
".",
"chr",
"if",
"type",
".",
"is_a?",
"(",
"Integer",
")",
"@signature",
"+=",
"type",
".",
"to_s",
"@params",
"<<",
"[",
"type",
",",
"val",
"]",
"end"
] | Add a parameter _val_ of type _type_ to the message. | [
"Add",
"a",
"parameter",
"_val_",
"of",
"type",
"_type_",
"to",
"the",
"message",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/message.rb#L128-L132 |
21,930 | mvidner/ruby-dbus | lib/dbus/message.rb | DBus.Message.marshall | def marshall
if @path == "/org/freedesktop/DBus/Local"
raise InvalidDestinationName
end
params = PacketMarshaller.new
@params.each do |param|
params.append(param[0], param[1])
end
@body_length = params.packet.bytesize
marshaller = PacketMarshaller.new
ma... | ruby | def marshall
if @path == "/org/freedesktop/DBus/Local"
raise InvalidDestinationName
end
params = PacketMarshaller.new
@params.each do |param|
params.append(param[0], param[1])
end
@body_length = params.packet.bytesize
marshaller = PacketMarshaller.new
ma... | [
"def",
"marshall",
"if",
"@path",
"==",
"\"/org/freedesktop/DBus/Local\"",
"raise",
"InvalidDestinationName",
"end",
"params",
"=",
"PacketMarshaller",
".",
"new",
"@params",
".",
"each",
"do",
"|",
"param",
"|",
"params",
".",
"append",
"(",
"param",
"[",
"0",
... | Marshall the message with its current set parameters and return
it in a packet form. | [
"Marshall",
"the",
"message",
"with",
"its",
"current",
"set",
"parameters",
"and",
"return",
"it",
"in",
"a",
"packet",
"form",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/message.rb#L150-L185 |
21,931 | mvidner/ruby-dbus | lib/dbus/message.rb | DBus.Message.unmarshall_buffer | def unmarshall_buffer(buf)
buf = buf.dup
endianness = if buf[0] == "l"
LIL_END
else
BIG_END
end
pu = PacketUnmarshaller.new(buf, endianness)
mdata = pu.unmarshall(MESSAGE_SIGNATURE)
_, @message_type, @flags, @p... | ruby | def unmarshall_buffer(buf)
buf = buf.dup
endianness = if buf[0] == "l"
LIL_END
else
BIG_END
end
pu = PacketUnmarshaller.new(buf, endianness)
mdata = pu.unmarshall(MESSAGE_SIGNATURE)
_, @message_type, @flags, @p... | [
"def",
"unmarshall_buffer",
"(",
"buf",
")",
"buf",
"=",
"buf",
".",
"dup",
"endianness",
"=",
"if",
"buf",
"[",
"0",
"]",
"==",
"\"l\"",
"LIL_END",
"else",
"BIG_END",
"end",
"pu",
"=",
"PacketUnmarshaller",
".",
"new",
"(",
"buf",
",",
"endianness",
"... | Unmarshall a packet contained in the buffer _buf_ and set the
parameters of the message object according the data found in the
buffer.
@return [Array(Message,Integer)]
the detected message (self) and
the index pointer of the buffer where the message data ended. | [
"Unmarshall",
"a",
"packet",
"contained",
"in",
"the",
"buffer",
"_buf_",
"and",
"set",
"the",
"parameters",
"of",
"the",
"message",
"object",
"according",
"the",
"data",
"found",
"in",
"the",
"buffer",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/message.rb#L193-L230 |
21,932 | mvidner/ruby-dbus | lib/dbus/message.rb | DBus.Message.annotate_exception | def annotate_exception(ex)
new_ex = ex.exception("#{ex}; caused by #{self}")
new_ex.set_backtrace(ex.backtrace)
new_ex
end | ruby | def annotate_exception(ex)
new_ex = ex.exception("#{ex}; caused by #{self}")
new_ex.set_backtrace(ex.backtrace)
new_ex
end | [
"def",
"annotate_exception",
"(",
"ex",
")",
"new_ex",
"=",
"ex",
".",
"exception",
"(",
"\"#{ex}; caused by #{self}\"",
")",
"new_ex",
".",
"set_backtrace",
"(",
"ex",
".",
"backtrace",
")",
"new_ex",
"end"
] | Make a new exception from ex, mark it as being caused by this message
@api private | [
"Make",
"a",
"new",
"exception",
"from",
"ex",
"mark",
"it",
"as",
"being",
"caused",
"by",
"this",
"message"
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/message.rb#L234-L238 |
21,933 | mvidner/ruby-dbus | lib/dbus/marshall.rb | DBus.PacketUnmarshaller.unmarshall | def unmarshall(signature, len = nil)
if !len.nil?
if @buffy.bytesize < @idx + len
raise IncompleteBufferException
end
end
sigtree = Type::Parser.new(signature).parse
ret = []
sigtree.each do |elem|
ret << do_parse(elem)
end
ret
end | ruby | def unmarshall(signature, len = nil)
if !len.nil?
if @buffy.bytesize < @idx + len
raise IncompleteBufferException
end
end
sigtree = Type::Parser.new(signature).parse
ret = []
sigtree.each do |elem|
ret << do_parse(elem)
end
ret
end | [
"def",
"unmarshall",
"(",
"signature",
",",
"len",
"=",
"nil",
")",
"if",
"!",
"len",
".",
"nil?",
"if",
"@buffy",
".",
"bytesize",
"<",
"@idx",
"+",
"len",
"raise",
"IncompleteBufferException",
"end",
"end",
"sigtree",
"=",
"Type",
"::",
"Parser",
".",
... | Create a new unmarshaller for the given data _buffer_ and _endianness_.
Unmarshall the buffer for a given _signature_ and length _len_.
Return an array of unmarshalled objects | [
"Create",
"a",
"new",
"unmarshaller",
"for",
"the",
"given",
"data",
"_buffer_",
"and",
"_endianness_",
".",
"Unmarshall",
"the",
"buffer",
"for",
"a",
"given",
"_signature_",
"and",
"length",
"_len_",
".",
"Return",
"an",
"array",
"of",
"unmarshalled",
"objec... | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/marshall.rb#L53-L65 |
21,934 | mvidner/ruby-dbus | lib/dbus/marshall.rb | DBus.PacketUnmarshaller.align | def align(a)
case a
when 1
nil
when 2, 4, 8
bits = a - 1
@idx = @idx + bits & ~bits
raise IncompleteBufferException if @idx > @buffy.bytesize
else
raise "Unsupported alignment #{a}"
end
end | ruby | def align(a)
case a
when 1
nil
when 2, 4, 8
bits = a - 1
@idx = @idx + bits & ~bits
raise IncompleteBufferException if @idx > @buffy.bytesize
else
raise "Unsupported alignment #{a}"
end
end | [
"def",
"align",
"(",
"a",
")",
"case",
"a",
"when",
"1",
"nil",
"when",
"2",
",",
"4",
",",
"8",
"bits",
"=",
"a",
"-",
"1",
"@idx",
"=",
"@idx",
"+",
"bits",
"&",
"~",
"bits",
"raise",
"IncompleteBufferException",
"if",
"@idx",
">",
"@buffy",
".... | Align the pointer index on a byte index of _a_, where a
must be 1, 2, 4 or 8. | [
"Align",
"the",
"pointer",
"index",
"on",
"a",
"byte",
"index",
"of",
"_a_",
"where",
"a",
"must",
"be",
"1",
"2",
"4",
"or",
"8",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/marshall.rb#L69-L80 |
21,935 | mvidner/ruby-dbus | lib/dbus/marshall.rb | DBus.PacketUnmarshaller.read | def read(nbytes)
raise IncompleteBufferException if @idx + nbytes > @buffy.bytesize
ret = @buffy.slice(@idx, nbytes)
@idx += nbytes
ret
end | ruby | def read(nbytes)
raise IncompleteBufferException if @idx + nbytes > @buffy.bytesize
ret = @buffy.slice(@idx, nbytes)
@idx += nbytes
ret
end | [
"def",
"read",
"(",
"nbytes",
")",
"raise",
"IncompleteBufferException",
"if",
"@idx",
"+",
"nbytes",
">",
"@buffy",
".",
"bytesize",
"ret",
"=",
"@buffy",
".",
"slice",
"(",
"@idx",
",",
"nbytes",
")",
"@idx",
"+=",
"nbytes",
"ret",
"end"
] | Retrieve the next _nbytes_ number of bytes from the buffer. | [
"Retrieve",
"the",
"next",
"_nbytes_",
"number",
"of",
"bytes",
"from",
"the",
"buffer",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/marshall.rb#L88-L93 |
21,936 | mvidner/ruby-dbus | lib/dbus/marshall.rb | DBus.PacketUnmarshaller.read_string | def read_string
align(4)
str_sz = read(4).unpack(@uint32)[0]
ret = @buffy.slice(@idx, str_sz)
raise IncompleteBufferException if @idx + str_sz + 1 > @buffy.bytesize
@idx += str_sz
if @buffy[@idx].ord != 0
raise InvalidPacketException, "String is not nul-terminated"
end
... | ruby | def read_string
align(4)
str_sz = read(4).unpack(@uint32)[0]
ret = @buffy.slice(@idx, str_sz)
raise IncompleteBufferException if @idx + str_sz + 1 > @buffy.bytesize
@idx += str_sz
if @buffy[@idx].ord != 0
raise InvalidPacketException, "String is not nul-terminated"
end
... | [
"def",
"read_string",
"align",
"(",
"4",
")",
"str_sz",
"=",
"read",
"(",
"4",
")",
".",
"unpack",
"(",
"@uint32",
")",
"[",
"0",
"]",
"ret",
"=",
"@buffy",
".",
"slice",
"(",
"@idx",
",",
"str_sz",
")",
"raise",
"IncompleteBufferException",
"if",
"@... | Read the string length and string itself from the buffer.
Return the string. | [
"Read",
"the",
"string",
"length",
"and",
"string",
"itself",
"from",
"the",
"buffer",
".",
"Return",
"the",
"string",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/marshall.rb#L97-L109 |
21,937 | mvidner/ruby-dbus | lib/dbus/marshall.rb | DBus.PacketUnmarshaller.read_signature | def read_signature
str_sz = read(1).unpack("C")[0]
ret = @buffy.slice(@idx, str_sz)
raise IncompleteBufferException if @idx + str_sz + 1 >= @buffy.bytesize
@idx += str_sz
if @buffy[@idx].ord != 0
raise InvalidPacketException, "Type is not nul-terminated"
end
@idx += 1
... | ruby | def read_signature
str_sz = read(1).unpack("C")[0]
ret = @buffy.slice(@idx, str_sz)
raise IncompleteBufferException if @idx + str_sz + 1 >= @buffy.bytesize
@idx += str_sz
if @buffy[@idx].ord != 0
raise InvalidPacketException, "Type is not nul-terminated"
end
@idx += 1
... | [
"def",
"read_signature",
"str_sz",
"=",
"read",
"(",
"1",
")",
".",
"unpack",
"(",
"\"C\"",
")",
"[",
"0",
"]",
"ret",
"=",
"@buffy",
".",
"slice",
"(",
"@idx",
",",
"str_sz",
")",
"raise",
"IncompleteBufferException",
"if",
"@idx",
"+",
"str_sz",
"+",... | Read the signature length and signature itself from the buffer.
Return the signature. | [
"Read",
"the",
"signature",
"length",
"and",
"signature",
"itself",
"from",
"the",
"buffer",
".",
"Return",
"the",
"signature",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/marshall.rb#L113-L124 |
21,938 | mvidner/ruby-dbus | lib/dbus/marshall.rb | DBus.PacketMarshaller.num_align | def num_align(n, a)
case a
when 1, 2, 4, 8
bits = a - 1
n + bits & ~bits
else
raise "Unsupported alignment"
end
end | ruby | def num_align(n, a)
case a
when 1, 2, 4, 8
bits = a - 1
n + bits & ~bits
else
raise "Unsupported alignment"
end
end | [
"def",
"num_align",
"(",
"n",
",",
"a",
")",
"case",
"a",
"when",
"1",
",",
"2",
",",
"4",
",",
"8",
"bits",
"=",
"a",
"-",
"1",
"n",
"+",
"bits",
"&",
"~",
"bits",
"else",
"raise",
"\"Unsupported alignment\"",
"end",
"end"
] | Create a new marshaller, setting the current packet to the
empty packet.
Round _n_ up to the specified power of two, _a_ | [
"Create",
"a",
"new",
"marshaller",
"setting",
"the",
"current",
"packet",
"to",
"the",
"empty",
"packet",
".",
"Round",
"_n_",
"up",
"to",
"the",
"specified",
"power",
"of",
"two",
"_a_"
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/marshall.rb#L247-L255 |
21,939 | mvidner/ruby-dbus | lib/dbus/marshall.rb | DBus.PacketMarshaller.array | def array(type)
# Thanks to Peter Rullmann for this line
align(4)
sizeidx = @packet.bytesize
@packet += "ABCD"
align(type.alignment)
contentidx = @packet.bytesize
yield
sz = @packet.bytesize - contentidx
raise InvalidPacketException if sz > 67_108_864
@packet[... | ruby | def array(type)
# Thanks to Peter Rullmann for this line
align(4)
sizeidx = @packet.bytesize
@packet += "ABCD"
align(type.alignment)
contentidx = @packet.bytesize
yield
sz = @packet.bytesize - contentidx
raise InvalidPacketException if sz > 67_108_864
@packet[... | [
"def",
"array",
"(",
"type",
")",
"# Thanks to Peter Rullmann for this line",
"align",
"(",
"4",
")",
"sizeidx",
"=",
"@packet",
".",
"bytesize",
"@packet",
"+=",
"\"ABCD\"",
"align",
"(",
"type",
".",
"alignment",
")",
"contentidx",
"=",
"@packet",
".",
"byte... | Append the array type _type_ to the packet and allow for appending
the child elements. | [
"Append",
"the",
"array",
"type",
"_type_",
"to",
"the",
"packet",
"and",
"allow",
"for",
"appending",
"the",
"child",
"elements",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/marshall.rb#L275-L286 |
21,940 | mvidner/ruby-dbus | lib/dbus/bus.rb | DBus.Service.object | def object(path, api: ApiOptions::A0)
node = get_node(path, _create = true)
if node.object.nil? || node.object.api != api
node.object = ProxyObject.new(
@bus, @name, path,
api: api
)
end
node.object
end | ruby | def object(path, api: ApiOptions::A0)
node = get_node(path, _create = true)
if node.object.nil? || node.object.api != api
node.object = ProxyObject.new(
@bus, @name, path,
api: api
)
end
node.object
end | [
"def",
"object",
"(",
"path",
",",
"api",
":",
"ApiOptions",
"::",
"A0",
")",
"node",
"=",
"get_node",
"(",
"path",
",",
"_create",
"=",
"true",
")",
"if",
"node",
".",
"object",
".",
"nil?",
"||",
"node",
".",
"object",
".",
"api",
"!=",
"api",
... | Retrieves an object at the given _path_
whose methods always return an array.
@return [ProxyObject] | [
"Retrieves",
"an",
"object",
"at",
"the",
"given",
"_path_",
"whose",
"methods",
"always",
"return",
"an",
"array",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/bus.rb#L59-L68 |
21,941 | mvidner/ruby-dbus | lib/dbus/bus.rb | DBus.Service.get_node | def get_node(path, create = false)
n = @root
path.sub(%r{^/}, "").split("/").each do |elem|
if !(n[elem])
return nil if !create
n[elem] = Node.new(elem)
end
n = n[elem]
end
if n.nil?
DBus.logger.debug "Warning, unknown object #{path}"
end... | ruby | def get_node(path, create = false)
n = @root
path.sub(%r{^/}, "").split("/").each do |elem|
if !(n[elem])
return nil if !create
n[elem] = Node.new(elem)
end
n = n[elem]
end
if n.nil?
DBus.logger.debug "Warning, unknown object #{path}"
end... | [
"def",
"get_node",
"(",
"path",
",",
"create",
"=",
"false",
")",
"n",
"=",
"@root",
"path",
".",
"sub",
"(",
"%r{",
"}",
",",
"\"\"",
")",
".",
"split",
"(",
"\"/\"",
")",
".",
"each",
"do",
"|",
"elem",
"|",
"if",
"!",
"(",
"n",
"[",
"elem"... | Get the object node corresponding to the given _path_. if _create_ is
true, the the nodes in the path are created if they do not already exist. | [
"Get",
"the",
"object",
"node",
"corresponding",
"to",
"the",
"given",
"_path_",
".",
"if",
"_create_",
"is",
"true",
"the",
"the",
"nodes",
"in",
"the",
"path",
"are",
"created",
"if",
"they",
"do",
"not",
"already",
"exist",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/bus.rb#L94-L107 |
21,942 | mvidner/ruby-dbus | lib/dbus/bus.rb | DBus.Service.rec_introspect | def rec_introspect(node, path)
xml = bus.introspect_data(@name, path)
intfs, subnodes = IntrospectXMLParser.new(xml).parse
subnodes.each do |nodename|
subnode = node[nodename] = Node.new(nodename)
subpath = if path == "/"
"/" + nodename
else
... | ruby | def rec_introspect(node, path)
xml = bus.introspect_data(@name, path)
intfs, subnodes = IntrospectXMLParser.new(xml).parse
subnodes.each do |nodename|
subnode = node[nodename] = Node.new(nodename)
subpath = if path == "/"
"/" + nodename
else
... | [
"def",
"rec_introspect",
"(",
"node",
",",
"path",
")",
"xml",
"=",
"bus",
".",
"introspect_data",
"(",
"@name",
",",
"path",
")",
"intfs",
",",
"subnodes",
"=",
"IntrospectXMLParser",
".",
"new",
"(",
"xml",
")",
".",
"parse",
"subnodes",
".",
"each",
... | Perform a recursive retrospection on the given current _node_
on the given _path_. | [
"Perform",
"a",
"recursive",
"retrospection",
"on",
"the",
"given",
"current",
"_node_",
"on",
"the",
"given",
"_path_",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/bus.rb#L117-L131 |
21,943 | mvidner/ruby-dbus | lib/dbus/bus.rb | DBus.Node.to_xml | def to_xml
xml = '<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
'
each_pair do |k, _v|
xml += "<node name=\"#{k}\" />"
end
if @object
@object.intfs.each_pair do |_k, v|
... | ruby | def to_xml
xml = '<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
'
each_pair do |k, _v|
xml += "<node name=\"#{k}\" />"
end
if @object
@object.intfs.each_pair do |_k, v|
... | [
"def",
"to_xml",
"xml",
"=",
"'<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n<node>\n'",
"each_pair",
"do",
"|",
"k",
",",
"_v",
"|",
"xml",
"+=",
"\"<node name=\\\"#{k}\\\" />\"",
"e... | Create a new node with a given _name_.
Return an XML string representation of the node.
It is shallow, not recursing into subnodes | [
"Create",
"a",
"new",
"node",
"with",
"a",
"given",
"_name_",
".",
"Return",
"an",
"XML",
"string",
"representation",
"of",
"the",
"node",
".",
"It",
"is",
"shallow",
"not",
"recursing",
"into",
"subnodes"
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/bus.rb#L151-L169 |
21,944 | mvidner/ruby-dbus | lib/dbus/bus.rb | DBus.Connection.glibize | def glibize
require "glib2"
# Circumvent a ruby-glib bug
@channels ||= []
gio = GLib::IOChannel.new(@message_queue.socket.fileno)
@channels << gio
gio.add_watch(GLib::IOChannel::IN) do |_c, _ch|
dispatch_message_queue
true
end
end | ruby | def glibize
require "glib2"
# Circumvent a ruby-glib bug
@channels ||= []
gio = GLib::IOChannel.new(@message_queue.socket.fileno)
@channels << gio
gio.add_watch(GLib::IOChannel::IN) do |_c, _ch|
dispatch_message_queue
true
end
end | [
"def",
"glibize",
"require",
"\"glib2\"",
"# Circumvent a ruby-glib bug",
"@channels",
"||=",
"[",
"]",
"gio",
"=",
"GLib",
"::",
"IOChannel",
".",
"new",
"(",
"@message_queue",
".",
"socket",
".",
"fileno",
")",
"@channels",
"<<",
"gio",
"gio",
".",
"add_watc... | Tell a bus to register itself on the glib main loop | [
"Tell",
"a",
"bus",
"to",
"register",
"itself",
"on",
"the",
"glib",
"main",
"loop"
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/bus.rb#L225-L236 |
21,945 | mvidner/ruby-dbus | lib/dbus/bus.rb | DBus.Connection.request_service | def request_service(name)
# Use RequestName, but asynchronously!
# A synchronous call would not work with service activation, where
# method calls to be serviced arrive before the reply for RequestName
# (Ticket#29).
proxy.RequestName(name, NAME_FLAG_REPLACE_EXISTING) do |rmsg, r|
... | ruby | def request_service(name)
# Use RequestName, but asynchronously!
# A synchronous call would not work with service activation, where
# method calls to be serviced arrive before the reply for RequestName
# (Ticket#29).
proxy.RequestName(name, NAME_FLAG_REPLACE_EXISTING) do |rmsg, r|
... | [
"def",
"request_service",
"(",
"name",
")",
"# Use RequestName, but asynchronously!",
"# A synchronous call would not work with service activation, where",
"# method calls to be serviced arrive before the reply for RequestName",
"# (Ticket#29).",
"proxy",
".",
"RequestName",
"(",
"name",
... | Attempt to request a service _name_.
FIXME, NameRequestError cannot really be rescued as it will be raised
when dispatching a later call. Rework the API to better match the spec.
@return [Service] | [
"Attempt",
"to",
"request",
"a",
"service",
"_name_",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/bus.rb#L407-L419 |
21,946 | mvidner/ruby-dbus | lib/dbus/bus.rb | DBus.Connection.proxy | def proxy
if @proxy.nil?
path = "/org/freedesktop/DBus"
dest = "org.freedesktop.DBus"
pof = DBus::ProxyObjectFactory.new(
DBUSXMLINTRO, self, dest, path,
api: ApiOptions::A0
)
@proxy = pof.build["org.freedesktop.DBus"]
end
@proxy
end | ruby | def proxy
if @proxy.nil?
path = "/org/freedesktop/DBus"
dest = "org.freedesktop.DBus"
pof = DBus::ProxyObjectFactory.new(
DBUSXMLINTRO, self, dest, path,
api: ApiOptions::A0
)
@proxy = pof.build["org.freedesktop.DBus"]
end
@proxy
end | [
"def",
"proxy",
"if",
"@proxy",
".",
"nil?",
"path",
"=",
"\"/org/freedesktop/DBus\"",
"dest",
"=",
"\"org.freedesktop.DBus\"",
"pof",
"=",
"DBus",
"::",
"ProxyObjectFactory",
".",
"new",
"(",
"DBUSXMLINTRO",
",",
"self",
",",
"dest",
",",
"path",
",",
"api",
... | Set up a ProxyObject for the bus itself, since the bus is introspectable.
@return [ProxyObject] that always returns an array
({DBus::ApiOptions#proxy_method_returns_array})
Returns the object. | [
"Set",
"up",
"a",
"ProxyObject",
"for",
"the",
"bus",
"itself",
"since",
"the",
"bus",
"is",
"introspectable",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/bus.rb#L425-L436 |
21,947 | mvidner/ruby-dbus | lib/dbus/bus.rb | DBus.Connection.add_match | def add_match(mr, &slot)
# check this is a signal.
mrs = mr.to_s
DBus.logger.debug "#{@signal_matchrules.size} rules, adding #{mrs.inspect}"
# don't ask for the same match if we override it
unless @signal_matchrules.key?(mrs)
DBus.logger.debug "Asked for a new match"
proxy.... | ruby | def add_match(mr, &slot)
# check this is a signal.
mrs = mr.to_s
DBus.logger.debug "#{@signal_matchrules.size} rules, adding #{mrs.inspect}"
# don't ask for the same match if we override it
unless @signal_matchrules.key?(mrs)
DBus.logger.debug "Asked for a new match"
proxy.... | [
"def",
"add_match",
"(",
"mr",
",",
"&",
"slot",
")",
"# check this is a signal.",
"mrs",
"=",
"mr",
".",
"to_s",
"DBus",
".",
"logger",
".",
"debug",
"\"#{@signal_matchrules.size} rules, adding #{mrs.inspect}\"",
"# don't ask for the same match if we override it",
"unless"... | Asks bus to send us messages matching mr, and execute slot when
received | [
"Asks",
"bus",
"to",
"send",
"us",
"messages",
"matching",
"mr",
"and",
"execute",
"slot",
"when",
"received"
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/bus.rb#L477-L487 |
21,948 | mvidner/ruby-dbus | lib/dbus/bus.rb | DBus.Connection.send_hello | def send_hello
m = Message.new(DBus::Message::METHOD_CALL)
m.path = "/org/freedesktop/DBus"
m.destination = "org.freedesktop.DBus"
m.interface = "org.freedesktop.DBus"
m.member = "Hello"
send_sync(m) do |rmsg|
@unique_name = rmsg.destination
DBus.logger.debug "Got hel... | ruby | def send_hello
m = Message.new(DBus::Message::METHOD_CALL)
m.path = "/org/freedesktop/DBus"
m.destination = "org.freedesktop.DBus"
m.interface = "org.freedesktop.DBus"
m.member = "Hello"
send_sync(m) do |rmsg|
@unique_name = rmsg.destination
DBus.logger.debug "Got hel... | [
"def",
"send_hello",
"m",
"=",
"Message",
".",
"new",
"(",
"DBus",
"::",
"Message",
"::",
"METHOD_CALL",
")",
"m",
".",
"path",
"=",
"\"/org/freedesktop/DBus\"",
"m",
".",
"destination",
"=",
"\"org.freedesktop.DBus\"",
"m",
".",
"interface",
"=",
"\"org.freed... | Send a hello messages to the bus to let it know we are here. | [
"Send",
"a",
"hello",
"messages",
"to",
"the",
"bus",
"to",
"let",
"it",
"know",
"we",
"are",
"here",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/bus.rb#L584-L595 |
21,949 | mvidner/ruby-dbus | lib/dbus/bus.rb | DBus.Main.run | def run
# before blocking, empty the buffers
# https://bugzilla.novell.com/show_bug.cgi?id=537401
@buses.each_value do |b|
while (m = b.message_queue.message_from_buffer_nonblock)
b.process(m)
end
end
while !@quitting && [email protected]?
ready = IO.select(@b... | ruby | def run
# before blocking, empty the buffers
# https://bugzilla.novell.com/show_bug.cgi?id=537401
@buses.each_value do |b|
while (m = b.message_queue.message_from_buffer_nonblock)
b.process(m)
end
end
while !@quitting && [email protected]?
ready = IO.select(@b... | [
"def",
"run",
"# before blocking, empty the buffers",
"# https://bugzilla.novell.com/show_bug.cgi?id=537401",
"@buses",
".",
"each_value",
"do",
"|",
"b",
"|",
"while",
"(",
"m",
"=",
"b",
".",
"message_queue",
".",
"message_from_buffer_nonblock",
")",
"b",
".",
"proces... | Run the main loop. This is a blocking call! | [
"Run",
"the",
"main",
"loop",
".",
"This",
"is",
"a",
"blocking",
"call!"
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/bus.rb#L717-L741 |
21,950 | mvidner/ruby-dbus | lib/dbus/auth.rb | DBus.External.authenticate | def authenticate
# Take the user id (eg integer 1000) make a string out of it "1000", take
# each character and determin hex value "1" => 0x31, "0" => 0x30. You
# obtain for "1000" => 31303030 This is what the server is expecting.
# Why? I dunno. How did I come to that conclusion? by looking at ... | ruby | def authenticate
# Take the user id (eg integer 1000) make a string out of it "1000", take
# each character and determin hex value "1" => 0x31, "0" => 0x30. You
# obtain for "1000" => 31303030 This is what the server is expecting.
# Why? I dunno. How did I come to that conclusion? by looking at ... | [
"def",
"authenticate",
"# Take the user id (eg integer 1000) make a string out of it \"1000\", take",
"# each character and determin hex value \"1\" => 0x31, \"0\" => 0x30. You",
"# obtain for \"1000\" => 31303030 This is what the server is expecting.",
"# Why? I dunno. How did I come to that conclusion? ... | Performs the authentication. | [
"Performs",
"the",
"authentication",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/auth.rb#L36-L43 |
21,951 | mvidner/ruby-dbus | lib/dbus/auth.rb | DBus.DBusCookieSHA1.hex_decode | def hex_decode(encoded)
encoded.scan(/[[:xdigit:]]{2}/).map { |h| h.hex.chr }.join
end | ruby | def hex_decode(encoded)
encoded.scan(/[[:xdigit:]]{2}/).map { |h| h.hex.chr }.join
end | [
"def",
"hex_decode",
"(",
"encoded",
")",
"encoded",
".",
"scan",
"(",
"/",
"/",
")",
".",
"map",
"{",
"|",
"h",
"|",
"h",
".",
"hex",
".",
"chr",
"}",
".",
"join",
"end"
] | decode hex to plain | [
"decode",
"hex",
"to",
"plain"
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/auth.rb#L107-L109 |
21,952 | mvidner/ruby-dbus | lib/dbus/auth.rb | DBus.Client.authenticate | def authenticate
if RbConfig::CONFIG["target_os"] =~ /freebsd/
@socket.sendmsg(0.chr, 0, nil, [:SOCKET, :SCM_CREDS, ""])
else
@socket.write(0.chr)
end
next_authenticator
@state = :Starting
while @state != :Authenticated
r = next_state
return r if !r
... | ruby | def authenticate
if RbConfig::CONFIG["target_os"] =~ /freebsd/
@socket.sendmsg(0.chr, 0, nil, [:SOCKET, :SCM_CREDS, ""])
else
@socket.write(0.chr)
end
next_authenticator
@state = :Starting
while @state != :Authenticated
r = next_state
return r if !r
... | [
"def",
"authenticate",
"if",
"RbConfig",
"::",
"CONFIG",
"[",
"\"target_os\"",
"]",
"=~",
"/",
"/",
"@socket",
".",
"sendmsg",
"(",
"0",
".",
"chr",
",",
"0",
",",
"nil",
",",
"[",
":SOCKET",
",",
":SCM_CREDS",
",",
"\"\"",
"]",
")",
"else",
"@socket... | Create a new authentication client.
Start the authentication process. | [
"Create",
"a",
"new",
"authentication",
"client",
".",
"Start",
"the",
"authentication",
"process",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/auth.rb#L126-L139 |
21,953 | mvidner/ruby-dbus | lib/dbus/auth.rb | DBus.Client.next_authenticator | def next_authenticator
raise AuthenticationFailed if @auth_list.empty?
@authenticator = @auth_list.shift.new
auth_msg = ["AUTH", @authenticator.name, @authenticator.authenticate]
DBus.logger.debug "auth_msg: #{auth_msg.inspect}"
send(auth_msg)
rescue AuthenticationFailed
@socket.... | ruby | def next_authenticator
raise AuthenticationFailed if @auth_list.empty?
@authenticator = @auth_list.shift.new
auth_msg = ["AUTH", @authenticator.name, @authenticator.authenticate]
DBus.logger.debug "auth_msg: #{auth_msg.inspect}"
send(auth_msg)
rescue AuthenticationFailed
@socket.... | [
"def",
"next_authenticator",
"raise",
"AuthenticationFailed",
"if",
"@auth_list",
".",
"empty?",
"@authenticator",
"=",
"@auth_list",
".",
"shift",
".",
"new",
"auth_msg",
"=",
"[",
"\"AUTH\"",
",",
"@authenticator",
".",
"name",
",",
"@authenticator",
".",
"authe... | Try authentication using the next authenticator. | [
"Try",
"authentication",
"using",
"the",
"next",
"authenticator",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/auth.rb#L155-L164 |
21,954 | mvidner/ruby-dbus | lib/dbus/introspect.rb | DBus.Interface.validate_name | def validate_name(name)
raise InvalidIntrospectionData if name.bytesize > 255
raise InvalidIntrospectionData if name =~ /^\./ || name =~ /\.$/
raise InvalidIntrospectionData if name =~ /\.\./
raise InvalidIntrospectionData if name !~ /\./
name.split(".").each do |element|
raise Inv... | ruby | def validate_name(name)
raise InvalidIntrospectionData if name.bytesize > 255
raise InvalidIntrospectionData if name =~ /^\./ || name =~ /\.$/
raise InvalidIntrospectionData if name =~ /\.\./
raise InvalidIntrospectionData if name !~ /\./
name.split(".").each do |element|
raise Inv... | [
"def",
"validate_name",
"(",
"name",
")",
"raise",
"InvalidIntrospectionData",
"if",
"name",
".",
"bytesize",
">",
"255",
"raise",
"InvalidIntrospectionData",
"if",
"name",
"=~",
"/",
"\\.",
"/",
"||",
"name",
"=~",
"/",
"\\.",
"/",
"raise",
"InvalidIntrospect... | Creates a new interface with a given _name_.
Validates a service _name_. | [
"Creates",
"a",
"new",
"interface",
"with",
"a",
"given",
"_name_",
".",
"Validates",
"a",
"service",
"_name_",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/introspect.rb#L49-L57 |
21,955 | mvidner/ruby-dbus | lib/dbus/introspect.rb | DBus.Interface.define | def define(m)
if m.is_a?(Method)
@methods[m.name.to_sym] = m
elsif m.is_a?(Signal)
@signals[m.name.to_sym] = m
end
end | ruby | def define(m)
if m.is_a?(Method)
@methods[m.name.to_sym] = m
elsif m.is_a?(Signal)
@signals[m.name.to_sym] = m
end
end | [
"def",
"define",
"(",
"m",
")",
"if",
"m",
".",
"is_a?",
"(",
"Method",
")",
"@methods",
"[",
"m",
".",
"name",
".",
"to_sym",
"]",
"=",
"m",
"elsif",
"m",
".",
"is_a?",
"(",
"Signal",
")",
"@signals",
"[",
"m",
".",
"name",
".",
"to_sym",
"]",... | Helper method for defining a method _m_. | [
"Helper",
"method",
"for",
"defining",
"a",
"method",
"_m_",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/introspect.rb#L60-L66 |
21,956 | mvidner/ruby-dbus | lib/dbus/introspect.rb | DBus.Interface.define_method | def define_method(id, prototype)
m = Method.new(id)
m.from_prototype(prototype)
define(m)
end | ruby | def define_method(id, prototype)
m = Method.new(id)
m.from_prototype(prototype)
define(m)
end | [
"def",
"define_method",
"(",
"id",
",",
"prototype",
")",
"m",
"=",
"Method",
".",
"new",
"(",
"id",
")",
"m",
".",
"from_prototype",
"(",
"prototype",
")",
"define",
"(",
"m",
")",
"end"
] | Defines a method with name _id_ and a given _prototype_ in the
interface. | [
"Defines",
"a",
"method",
"with",
"name",
"_id_",
"and",
"a",
"given",
"_prototype_",
"in",
"the",
"interface",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/introspect.rb#L71-L75 |
21,957 | mvidner/ruby-dbus | lib/dbus/introspect.rb | DBus.Method.from_prototype | def from_prototype(prototype)
prototype.split(/, */).each do |arg|
arg = arg.split(" ")
raise InvalidClassDefinition if arg.size != 2
dir, arg = arg
if arg =~ /:/
arg = arg.split(":")
name, sig = arg
else
sig = arg
end
case dir
... | ruby | def from_prototype(prototype)
prototype.split(/, */).each do |arg|
arg = arg.split(" ")
raise InvalidClassDefinition if arg.size != 2
dir, arg = arg
if arg =~ /:/
arg = arg.split(":")
name, sig = arg
else
sig = arg
end
case dir
... | [
"def",
"from_prototype",
"(",
"prototype",
")",
"prototype",
".",
"split",
"(",
"/",
"/",
")",
".",
"each",
"do",
"|",
"arg",
"|",
"arg",
"=",
"arg",
".",
"split",
"(",
"\" \"",
")",
"raise",
"InvalidClassDefinition",
"if",
"arg",
".",
"size",
"!=",
... | Add parameter types by parsing the given _prototype_. | [
"Add",
"parameter",
"types",
"by",
"parsing",
"the",
"given",
"_prototype_",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/introspect.rb#L151-L170 |
21,958 | mvidner/ruby-dbus | lib/dbus/introspect.rb | DBus.Method.to_xml | def to_xml
xml = %(<method name="#{@name}">\n)
@params.each do |param|
name = param.name ? %(name="#{param.name}" ) : ""
xml += %(<arg #{name}direction="in" type="#{param.type}"/>\n)
end
@rets.each do |param|
name = param.name ? %(name="#{param.name}" ) : ""
xml +... | ruby | def to_xml
xml = %(<method name="#{@name}">\n)
@params.each do |param|
name = param.name ? %(name="#{param.name}" ) : ""
xml += %(<arg #{name}direction="in" type="#{param.type}"/>\n)
end
@rets.each do |param|
name = param.name ? %(name="#{param.name}" ) : ""
xml +... | [
"def",
"to_xml",
"xml",
"=",
"%(<method name=\"#{@name}\">\\n)",
"@params",
".",
"each",
"do",
"|",
"param",
"|",
"name",
"=",
"param",
".",
"name",
"?",
"%(name=\"#{param.name}\" )",
":",
"\"\"",
"xml",
"+=",
"%(<arg #{name}direction=\"in\" type=\"#{param.type}\"/>\\n)... | Return an XML string representation of the method interface elment. | [
"Return",
"an",
"XML",
"string",
"representation",
"of",
"the",
"method",
"interface",
"elment",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/introspect.rb#L173-L185 |
21,959 | mvidner/ruby-dbus | lib/dbus/introspect.rb | DBus.Signal.from_prototype | def from_prototype(prototype)
prototype.split(/, */).each do |arg|
if arg =~ /:/
arg = arg.split(":")
name, sig = arg
else
sig = arg
end
add_fparam(name, sig)
end
self
end | ruby | def from_prototype(prototype)
prototype.split(/, */).each do |arg|
if arg =~ /:/
arg = arg.split(":")
name, sig = arg
else
sig = arg
end
add_fparam(name, sig)
end
self
end | [
"def",
"from_prototype",
"(",
"prototype",
")",
"prototype",
".",
"split",
"(",
"/",
"/",
")",
".",
"each",
"do",
"|",
"arg",
"|",
"if",
"arg",
"=~",
"/",
"/",
"arg",
"=",
"arg",
".",
"split",
"(",
"\":\"",
")",
"name",
",",
"sig",
"=",
"arg",
... | Add parameter types based on the given _prototype_. | [
"Add",
"parameter",
"types",
"based",
"on",
"the",
"given",
"_prototype_",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/introspect.rb#L193-L204 |
21,960 | mvidner/ruby-dbus | lib/dbus/introspect.rb | DBus.Signal.to_xml | def to_xml
xml = %(<signal name="#{@name}">\n)
@params.each do |param|
name = param.name ? %(name="#{param.name}" ) : ""
xml += %(<arg #{name}type="#{param.type}"/>\n)
end
xml += %(</signal>\n)
xml
end | ruby | def to_xml
xml = %(<signal name="#{@name}">\n)
@params.each do |param|
name = param.name ? %(name="#{param.name}" ) : ""
xml += %(<arg #{name}type="#{param.type}"/>\n)
end
xml += %(</signal>\n)
xml
end | [
"def",
"to_xml",
"xml",
"=",
"%(<signal name=\"#{@name}\">\\n)",
"@params",
".",
"each",
"do",
"|",
"param",
"|",
"name",
"=",
"param",
".",
"name",
"?",
"%(name=\"#{param.name}\" )",
":",
"\"\"",
"xml",
"+=",
"%(<arg #{name}type=\"#{param.type}\"/>\\n)",
"end",
"xm... | Return an XML string representation of the signal interface elment. | [
"Return",
"an",
"XML",
"string",
"representation",
"of",
"the",
"signal",
"interface",
"elment",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/introspect.rb#L207-L215 |
21,961 | mvidner/ruby-dbus | lib/dbus/matchrule.rb | DBus.MatchRule.from_s | def from_s(str)
str.split(",").each do |eq|
next unless eq =~ /^(.*)='([^']*)'$/
# "
name = Regexp.last_match(1)
val = Regexp.last_match(2)
raise MatchRuleException, name unless FILTERS.member?(name.to_sym)
method(name + "=").call(val)
end
self
end | ruby | def from_s(str)
str.split(",").each do |eq|
next unless eq =~ /^(.*)='([^']*)'$/
# "
name = Regexp.last_match(1)
val = Regexp.last_match(2)
raise MatchRuleException, name unless FILTERS.member?(name.to_sym)
method(name + "=").call(val)
end
self
end | [
"def",
"from_s",
"(",
"str",
")",
"str",
".",
"split",
"(",
"\",\"",
")",
".",
"each",
"do",
"|",
"eq",
"|",
"next",
"unless",
"eq",
"=~",
"/",
"/",
"# \"",
"name",
"=",
"Regexp",
".",
"last_match",
"(",
"1",
")",
"val",
"=",
"Regexp",
".",
"la... | Parses a match rule string _s_ and sets the filters on the object. | [
"Parses",
"a",
"match",
"rule",
"string",
"_s_",
"and",
"sets",
"the",
"filters",
"on",
"the",
"object",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/matchrule.rb#L58-L68 |
21,962 | mvidner/ruby-dbus | lib/dbus/matchrule.rb | DBus.MatchRule.from_signal | def from_signal(intf, signal)
signal = signal.name unless signal.is_a?(String)
self.type = "signal"
self.interface = intf.name
self.member = signal
self.path = intf.object.path
self
end | ruby | def from_signal(intf, signal)
signal = signal.name unless signal.is_a?(String)
self.type = "signal"
self.interface = intf.name
self.member = signal
self.path = intf.object.path
self
end | [
"def",
"from_signal",
"(",
"intf",
",",
"signal",
")",
"signal",
"=",
"signal",
".",
"name",
"unless",
"signal",
".",
"is_a?",
"(",
"String",
")",
"self",
".",
"type",
"=",
"\"signal\"",
"self",
".",
"interface",
"=",
"intf",
".",
"name",
"self",
".",
... | Sets the match rule to filter for the given _signal_ and the
given interface _intf_. | [
"Sets",
"the",
"match",
"rule",
"to",
"filter",
"for",
"the",
"given",
"_signal_",
"and",
"the",
"given",
"interface",
"_intf_",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/matchrule.rb#L72-L79 |
21,963 | mvidner/ruby-dbus | lib/dbus/matchrule.rb | DBus.MatchRule.match | def match(msg)
if @type
if { Message::SIGNAL => "signal", Message::METHOD_CALL => "method_call",
Message::METHOD_RETURN => "method_return",
Message::ERROR => "error" }[msg.message_type] != @type
return false
end
end
return false if @interface && @int... | ruby | def match(msg)
if @type
if { Message::SIGNAL => "signal", Message::METHOD_CALL => "method_call",
Message::METHOD_RETURN => "method_return",
Message::ERROR => "error" }[msg.message_type] != @type
return false
end
end
return false if @interface && @int... | [
"def",
"match",
"(",
"msg",
")",
"if",
"@type",
"if",
"{",
"Message",
"::",
"SIGNAL",
"=>",
"\"signal\"",
",",
"Message",
"::",
"METHOD_CALL",
"=>",
"\"method_call\"",
",",
"Message",
"::",
"METHOD_RETURN",
"=>",
"\"method_return\"",
",",
"Message",
"::",
"E... | Determines whether a message _msg_ matches the match rule. | [
"Determines",
"whether",
"a",
"message",
"_msg_",
"matches",
"the",
"match",
"rule",
"."
] | 336f1871bf0f6a0669391fb2bcf7f3a003ec97c9 | https://github.com/mvidner/ruby-dbus/blob/336f1871bf0f6a0669391fb2bcf7f3a003ec97c9/lib/dbus/matchrule.rb#L82-L95 |
21,964 | capitalone/screen-object | appium/lib/screen-object/accessors.rb | ScreenObject.Accessors.button | def button(name, locator)
# generates method for clicking button.
# this method will not return any value.
# @example click on 'Submit' button.
# button(:login_button,"xpath~//UIButtonField")
# def click_login_button
# login_button # This will click on the button.
... | ruby | def button(name, locator)
# generates method for clicking button.
# this method will not return any value.
# @example click on 'Submit' button.
# button(:login_button,"xpath~//UIButtonField")
# def click_login_button
# login_button # This will click on the button.
... | [
"def",
"button",
"(",
"name",
",",
"locator",
")",
"# generates method for clicking button.",
"# this method will not return any value.",
"# @example click on 'Submit' button.",
"# button(:login_button,\"xpath~//UIButtonField\")",
"# def click_login_button",
"# login_button # This will clic... | Button class generates all the methods related to different operations that can be performed on the button. | [
"Button",
"class",
"generates",
"all",
"the",
"methods",
"related",
"to",
"different",
"operations",
"that",
"can",
"be",
"performed",
"on",
"the",
"button",
"."
] | 9e206b09db3957c98b35502acb6549e5d0290f74 | https://github.com/capitalone/screen-object/blob/9e206b09db3957c98b35502acb6549e5d0290f74/appium/lib/screen-object/accessors.rb#L28-L192 |
21,965 | capitalone/screen-object | appium/lib/screen-object/accessors.rb | ScreenObject.Accessors.checkbox | def checkbox(name, locator)
# generates method for checking the checkbox object.
# this will not return any value
# @example check if 'remember me' checkbox is not checked.
# checkbox(:remember_me,"xpath~//UICheckBox")
# DSL to check the 'remember me' check box.
# def ch... | ruby | def checkbox(name, locator)
# generates method for checking the checkbox object.
# this will not return any value
# @example check if 'remember me' checkbox is not checked.
# checkbox(:remember_me,"xpath~//UICheckBox")
# DSL to check the 'remember me' check box.
# def ch... | [
"def",
"checkbox",
"(",
"name",
",",
"locator",
")",
"# generates method for checking the checkbox object.",
"# this will not return any value",
"# @example check if 'remember me' checkbox is not checked.",
"# checkbox(:remember_me,\"xpath~//UICheckBox\")",
"# DSL to check the 'remember me' ch... | end of button class.
Checkbox class generates all the methods related to different operations that can be performed on the check box on the screen. | [
"end",
"of",
"button",
"class",
".",
"Checkbox",
"class",
"generates",
"all",
"the",
"methods",
"related",
"to",
"different",
"operations",
"that",
"can",
"be",
"performed",
"on",
"the",
"check",
"box",
"on",
"the",
"screen",
"."
] | 9e206b09db3957c98b35502acb6549e5d0290f74 | https://github.com/capitalone/screen-object/blob/9e206b09db3957c98b35502acb6549e5d0290f74/appium/lib/screen-object/accessors.rb#L195-L240 |
21,966 | capitalone/screen-object | appium/lib/screen-object/accessors.rb | ScreenObject.Accessors.text | def text(name,locator)
# generates method for clicking button.
# this method will not return any value.
# @example click on 'Submit' button.
# button(:login_button,"xpath~//UIButtonField")
# def click_login_button
# login_button # This will click on the button.
... | ruby | def text(name,locator)
# generates method for clicking button.
# this method will not return any value.
# @example click on 'Submit' button.
# button(:login_button,"xpath~//UIButtonField")
# def click_login_button
# login_button # This will click on the button.
... | [
"def",
"text",
"(",
"name",
",",
"locator",
")",
"# generates method for clicking button.",
"# this method will not return any value.",
"# @example click on 'Submit' button.",
"# button(:login_button,\"xpath~//UIButtonField\")",
"# def click_login_button",
"# login_button # This will click ... | Text class generates all the methods related to different operations that can be performed on the text object on the screen. | [
"Text",
"class",
"generates",
"all",
"the",
"methods",
"related",
"to",
"different",
"operations",
"that",
"can",
"be",
"performed",
"on",
"the",
"text",
"object",
"on",
"the",
"screen",
"."
] | 9e206b09db3957c98b35502acb6549e5d0290f74 | https://github.com/capitalone/screen-object/blob/9e206b09db3957c98b35502acb6549e5d0290f74/appium/lib/screen-object/accessors.rb#L244-L334 |
21,967 | capitalone/screen-object | appium/lib/screen-object/accessors.rb | ScreenObject.Accessors.text_field | def text_field(name,locator)
# generates method for setting text into text field.
# There is no return value for this method.
# @example setting username field.
# DSL for entering text in username text field.
# def set_username_text_field(username)
# self.username=user... | ruby | def text_field(name,locator)
# generates method for setting text into text field.
# There is no return value for this method.
# @example setting username field.
# DSL for entering text in username text field.
# def set_username_text_field(username)
# self.username=user... | [
"def",
"text_field",
"(",
"name",
",",
"locator",
")",
"# generates method for setting text into text field.",
"# There is no return value for this method.",
"# @example setting username field.",
"# DSL for entering text in username text field.",
"# def set_username_text_field(username)",
"#... | text_field class generates all the methods related to different operations that can be performed on the text_field object on the screen. | [
"text_field",
"class",
"generates",
"all",
"the",
"methods",
"related",
"to",
"different",
"operations",
"that",
"can",
"be",
"performed",
"on",
"the",
"text_field",
"object",
"on",
"the",
"screen",
"."
] | 9e206b09db3957c98b35502acb6549e5d0290f74 | https://github.com/capitalone/screen-object/blob/9e206b09db3957c98b35502acb6549e5d0290f74/appium/lib/screen-object/accessors.rb#L337-L411 |
21,968 | capitalone/screen-object | appium/lib/screen-object/accessors.rb | ScreenObject.Accessors.image | def image(name,locator)
# generates method for checking the existence of the image.
# this will return true or false based on if image is available or not
# @example check if 'logo' image is displayed on the page
# text(:logo,"xpath~//UITextField")
# DSL for clicking the logo im... | ruby | def image(name,locator)
# generates method for checking the existence of the image.
# this will return true or false based on if image is available or not
# @example check if 'logo' image is displayed on the page
# text(:logo,"xpath~//UITextField")
# DSL for clicking the logo im... | [
"def",
"image",
"(",
"name",
",",
"locator",
")",
"# generates method for checking the existence of the image.",
"# this will return true or false based on if image is available or not",
"# @example check if 'logo' image is displayed on the page",
"# text(:logo,\"xpath~//UITextField\")",
"# DS... | Image class generates all the methods related to different operations that can be performed on the image object on the screen. | [
"Image",
"class",
"generates",
"all",
"the",
"methods",
"related",
"to",
"different",
"operations",
"that",
"can",
"be",
"performed",
"on",
"the",
"image",
"object",
"on",
"the",
"screen",
"."
] | 9e206b09db3957c98b35502acb6549e5d0290f74 | https://github.com/capitalone/screen-object/blob/9e206b09db3957c98b35502acb6549e5d0290f74/appium/lib/screen-object/accessors.rb#L415-L440 |
21,969 | capitalone/screen-object | appium/lib/screen-object/accessors.rb | ScreenObject.Accessors.table | def table(name, locator)
#generates method for counting total no of cells in table
define_method("#{name}_cell_count") do
ScreenObject::AppElements::Table.new(locator).cell_count
end
end | ruby | def table(name, locator)
#generates method for counting total no of cells in table
define_method("#{name}_cell_count") do
ScreenObject::AppElements::Table.new(locator).cell_count
end
end | [
"def",
"table",
"(",
"name",
",",
"locator",
")",
"#generates method for counting total no of cells in table",
"define_method",
"(",
"\"#{name}_cell_count\"",
")",
"do",
"ScreenObject",
"::",
"AppElements",
"::",
"Table",
".",
"new",
"(",
"locator",
")",
".",
"cell_co... | table class generates all the methods related to different operations that can be performed on the table object on the screen. | [
"table",
"class",
"generates",
"all",
"the",
"methods",
"related",
"to",
"different",
"operations",
"that",
"can",
"be",
"performed",
"on",
"the",
"table",
"object",
"on",
"the",
"screen",
"."
] | 9e206b09db3957c98b35502acb6549e5d0290f74 | https://github.com/capitalone/screen-object/blob/9e206b09db3957c98b35502acb6549e5d0290f74/appium/lib/screen-object/accessors.rb#L443-L448 |
21,970 | maoueh/nugrant | lib/nugrant/bag.rb | Nugrant.Bag.__convert_value | def __convert_value(value)
case
# Converts Hash to Bag instance
when value.kind_of?(Hash)
Bag.new(value, @__config)
# Converts Array elements to Bag instances if needed
when value.kind_of?(Array)
value.map(&self.method(:__convert_value))
# Keeps as-is other elements... | ruby | def __convert_value(value)
case
# Converts Hash to Bag instance
when value.kind_of?(Hash)
Bag.new(value, @__config)
# Converts Array elements to Bag instances if needed
when value.kind_of?(Array)
value.map(&self.method(:__convert_value))
# Keeps as-is other elements... | [
"def",
"__convert_value",
"(",
"value",
")",
"case",
"# Converts Hash to Bag instance",
"when",
"value",
".",
"kind_of?",
"(",
"Hash",
")",
"Bag",
".",
"new",
"(",
"value",
",",
"@__config",
")",
"# Converts Array elements to Bag instances if needed",
"when",
"value",... | This function change value convertible to Bag into actual Bag.
This trick enable deeply using all Bag functionalities and also
ensures at the same time a deeply preventive copy since a new
instance is created for this nested structure.
In addition, it also transforms array elements of type Hash into
Bag instance ... | [
"This",
"function",
"change",
"value",
"convertible",
"to",
"Bag",
"into",
"actual",
"Bag",
".",
"This",
"trick",
"enable",
"deeply",
"using",
"all",
"Bag",
"functionalities",
"and",
"also",
"ensures",
"at",
"the",
"same",
"time",
"a",
"deeply",
"preventive",
... | 06186127a7dbe49a3018b077da3f5405a604aa0b | https://github.com/maoueh/nugrant/blob/06186127a7dbe49a3018b077da3f5405a604aa0b/lib/nugrant/bag.rb#L188-L202 |
21,971 | pepabo/furik | lib/furik/pull_requests.rb | Furik.PullRequests.pull_requests | def pull_requests(repo_name)
org_name = org_name_from(repo_name)
unless @block
if @org_name == org_name
print '-'
else
puts ''
print "#{org_name} -"
@org_name = org_name
end
end
issues = @client.issues(repo_name, creator: @login, ... | ruby | def pull_requests(repo_name)
org_name = org_name_from(repo_name)
unless @block
if @org_name == org_name
print '-'
else
puts ''
print "#{org_name} -"
@org_name = org_name
end
end
issues = @client.issues(repo_name, creator: @login, ... | [
"def",
"pull_requests",
"(",
"repo_name",
")",
"org_name",
"=",
"org_name_from",
"(",
"repo_name",
")",
"unless",
"@block",
"if",
"@org_name",
"==",
"org_name",
"print",
"'-'",
"else",
"puts",
"''",
"print",
"\"#{org_name} -\"",
"@org_name",
"=",
"org_name",
"en... | Use the issues api so specify the creator | [
"Use",
"the",
"issues",
"api",
"so",
"specify",
"the",
"creator"
] | b2b17d9ab7dbed51f6de8023331dc72e3c856ed5 | https://github.com/pepabo/furik/blob/b2b17d9ab7dbed51f6de8023331dc72e3c856ed5/lib/furik/pull_requests.rb#L38-L62 |
21,972 | darkskyapp/darksky-ruby | lib/darksky/api.rb | Darksky.API.precipitation | def precipitation(latitudes_longitudes_times, options = {})
return if latitudes_longitudes_times.size % 3 != 0
params = []
latitudes_longitudes_times.each_slice(3) do |data|
params << data.join(',')
end
response = Typhoeus::Request.get("#{DARKSKY_API_URL}/precipitation/#{@api... | ruby | def precipitation(latitudes_longitudes_times, options = {})
return if latitudes_longitudes_times.size % 3 != 0
params = []
latitudes_longitudes_times.each_slice(3) do |data|
params << data.join(',')
end
response = Typhoeus::Request.get("#{DARKSKY_API_URL}/precipitation/#{@api... | [
"def",
"precipitation",
"(",
"latitudes_longitudes_times",
",",
"options",
"=",
"{",
"}",
")",
"return",
"if",
"latitudes_longitudes_times",
".",
"size",
"%",
"3",
"!=",
"0",
"params",
"=",
"[",
"]",
"latitudes_longitudes_times",
".",
"each_slice",
"(",
"3",
"... | Returns forecasts for a collection of arbitrary points.
@param latitudes_longitudes_times [Array] Triplets of latitude, longitude and time. Example: ['42.7','-73.6',1325607100,'42.0','-73.0',1325607791]
@param option [Hash] (Optional) Options to be passed to the Typhoeus::Request | [
"Returns",
"forecasts",
"for",
"a",
"collection",
"of",
"arbitrary",
"points",
"."
] | 8cee1e294f3b0f465545d61f68cf74afd76159ce | https://github.com/darkskyapp/darksky-ruby/blob/8cee1e294f3b0f465545d61f68cf74afd76159ce/lib/darksky/api.rb#L41-L49 |
21,973 | darkskyapp/darksky-ruby | lib/darksky/api.rb | Darksky.API.interesting | def interesting(options = {})
response = Typhoeus::Request.get("#{DARKSKY_API_URL}/interesting/#{@api_key}", DEFAULT_OPTIONS.dup.merge(options))
JSON.parse(response.body) if response.code == 200
end | ruby | def interesting(options = {})
response = Typhoeus::Request.get("#{DARKSKY_API_URL}/interesting/#{@api_key}", DEFAULT_OPTIONS.dup.merge(options))
JSON.parse(response.body) if response.code == 200
end | [
"def",
"interesting",
"(",
"options",
"=",
"{",
"}",
")",
"response",
"=",
"Typhoeus",
"::",
"Request",
".",
"get",
"(",
"\"#{DARKSKY_API_URL}/interesting/#{@api_key}\"",
",",
"DEFAULT_OPTIONS",
".",
"dup",
".",
"merge",
"(",
"options",
")",
")",
"JSON",
".",
... | Returns a list of interesting storms happening right now.
@param option [Hash] (Optional) Options to be passed to the Typhoeus::Request | [
"Returns",
"a",
"list",
"of",
"interesting",
"storms",
"happening",
"right",
"now",
"."
] | 8cee1e294f3b0f465545d61f68cf74afd76159ce | https://github.com/darkskyapp/darksky-ruby/blob/8cee1e294f3b0f465545d61f68cf74afd76159ce/lib/darksky/api.rb#L54-L57 |
21,974 | godfat/rib | lib/rib/shell.rb | Rib.Shell.loop | def loop
before_loop
set_trap
start
in_loop
stop
self
rescue Exception => e
Rib.warn("Error while running loop:\n #{format_error(e)}")
raise
ensure
release_trap
after_loop
end | ruby | def loop
before_loop
set_trap
start
in_loop
stop
self
rescue Exception => e
Rib.warn("Error while running loop:\n #{format_error(e)}")
raise
ensure
release_trap
after_loop
end | [
"def",
"loop",
"before_loop",
"set_trap",
"start",
"in_loop",
"stop",
"self",
"rescue",
"Exception",
"=>",
"e",
"Rib",
".",
"warn",
"(",
"\"Error while running loop:\\n #{format_error(e)}\"",
")",
"raise",
"ensure",
"release_trap",
"after_loop",
"end"
] | Create a new shell.
@api public
@param config [Hash] The config of the shell.
@option config [String] :config ('~/.rib/config.rb')
The path to Rib config file.
@option config [String] :name ('rib')
The name of the shell. Used for Rib application.
@option config [String] :result_prompt ('=> ')
@option confi... | [
"Create",
"a",
"new",
"shell",
"."
] | fbbf62ac27751f930b8a606acdd0b12ca9276d33 | https://github.com/godfat/rib/blob/fbbf62ac27751f930b8a606acdd0b12ca9276d33/lib/rib/shell.rb#L47-L60 |
21,975 | godfat/rib | lib/rib/extra/paging.rb | Rib.Paging.one_screen? | def one_screen? str
cols, lines = `tput cols`.to_i, `tput lines`.to_i
(str.count("\n") + 2) <= lines && # count last line and prompt
str.gsub(/\e\[[^m]*m/, '').size <= cols * lines
end | ruby | def one_screen? str
cols, lines = `tput cols`.to_i, `tput lines`.to_i
(str.count("\n") + 2) <= lines && # count last line and prompt
str.gsub(/\e\[[^m]*m/, '').size <= cols * lines
end | [
"def",
"one_screen?",
"str",
"cols",
",",
"lines",
"=",
"`",
"`",
".",
"to_i",
",",
"`",
"`",
".",
"to_i",
"(",
"str",
".",
"count",
"(",
"\"\\n\"",
")",
"+",
"2",
")",
"<=",
"lines",
"&&",
"# count last line and prompt",
"str",
".",
"gsub",
"(",
"... | `less -F` can't cat the output, so we need to detect by ourselves.
`less -X` would mess up the buffers, so it's not desired, either. | [
"less",
"-",
"F",
"can",
"t",
"cat",
"the",
"output",
"so",
"we",
"need",
"to",
"detect",
"by",
"ourselves",
".",
"less",
"-",
"X",
"would",
"mess",
"up",
"the",
"buffers",
"so",
"it",
"s",
"not",
"desired",
"either",
"."
] | fbbf62ac27751f930b8a606acdd0b12ca9276d33 | https://github.com/godfat/rib/blob/fbbf62ac27751f930b8a606acdd0b12ca9276d33/lib/rib/extra/paging.rb#L22-L26 |
21,976 | quirkey/vegas | lib/vegas/runner.rb | Vegas.Runner.daemonize! | def daemonize!
if JRUBY
# It's not a true daemon but when executed with & works like one
thread = Thread.new {daemon_execute}
thread.join
elsif RUBY_VERSION < "1.9"
logger.debug "Parent Process: #{Process.pid}"
exit!(0) if fork
logger.debug "Child Process: #{... | ruby | def daemonize!
if JRUBY
# It's not a true daemon but when executed with & works like one
thread = Thread.new {daemon_execute}
thread.join
elsif RUBY_VERSION < "1.9"
logger.debug "Parent Process: #{Process.pid}"
exit!(0) if fork
logger.debug "Child Process: #{... | [
"def",
"daemonize!",
"if",
"JRUBY",
"# It's not a true daemon but when executed with & works like one",
"thread",
"=",
"Thread",
".",
"new",
"{",
"daemon_execute",
"}",
"thread",
".",
"join",
"elsif",
"RUBY_VERSION",
"<",
"\"1.9\"",
"logger",
".",
"debug",
"\"Parent Pro... | Adapted from Rackup | [
"Adapted",
"from",
"Rackup"
] | 2aee90e0be1971115dd2b765540036b39d367dca | https://github.com/quirkey/vegas/blob/2aee90e0be1971115dd2b765540036b39d367dca/lib/vegas/runner.rb#L184-L200 |
21,977 | quirkey/vegas | lib/vegas/runner.rb | Vegas.Runner.load_config_file | def load_config_file(config_path)
abort "Can not find config file at #{config_path}" if !File.readable?(config_path)
config = File.read(config_path)
# trim off anything after __END__
config.sub!(/^__END__\n.*/, '')
@app.module_eval(config)
end | ruby | def load_config_file(config_path)
abort "Can not find config file at #{config_path}" if !File.readable?(config_path)
config = File.read(config_path)
# trim off anything after __END__
config.sub!(/^__END__\n.*/, '')
@app.module_eval(config)
end | [
"def",
"load_config_file",
"(",
"config_path",
")",
"abort",
"\"Can not find config file at #{config_path}\"",
"if",
"!",
"File",
".",
"readable?",
"(",
"config_path",
")",
"config",
"=",
"File",
".",
"read",
"(",
"config_path",
")",
"# trim off anything after __END__",... | Loads a config file at config_path and evals it in the context of the @app. | [
"Loads",
"a",
"config",
"file",
"at",
"config_path",
"and",
"evals",
"it",
"in",
"the",
"context",
"of",
"the"
] | 2aee90e0be1971115dd2b765540036b39d367dca | https://github.com/quirkey/vegas/blob/2aee90e0be1971115dd2b765540036b39d367dca/lib/vegas/runner.rb#L240-L246 |
21,978 | evanphx/kpeg | lib/kpeg/code_generator.rb | KPeg.CodeGenerator.output_grammar | def output_grammar(code)
code << " # :stopdoc:\n"
handle_ast(code)
fg = @grammar.foreign_grammars
if fg.empty?
if @standalone
code << " def setup_foreign_grammar; end\n"
end
else
code << " def setup_foreign_grammar\n"
@grammar.foreign_grammars... | ruby | def output_grammar(code)
code << " # :stopdoc:\n"
handle_ast(code)
fg = @grammar.foreign_grammars
if fg.empty?
if @standalone
code << " def setup_foreign_grammar; end\n"
end
else
code << " def setup_foreign_grammar\n"
@grammar.foreign_grammars... | [
"def",
"output_grammar",
"(",
"code",
")",
"code",
"<<",
"\" # :stopdoc:\\n\"",
"handle_ast",
"(",
"code",
")",
"fg",
"=",
"@grammar",
".",
"foreign_grammars",
"if",
"fg",
".",
"empty?",
"if",
"@standalone",
"code",
"<<",
"\" def setup_foreign_grammar; end\\n\"",
... | Output of grammar and rules | [
"Output",
"of",
"grammar",
"and",
"rules"
] | 7ebf2e58e1248ffcbd0fe2cb552cc3bd12466eb9 | https://github.com/evanphx/kpeg/blob/7ebf2e58e1248ffcbd0fe2cb552cc3bd12466eb9/lib/kpeg/code_generator.rb#L361-L429 |
21,979 | evanphx/kpeg | lib/kpeg/code_generator.rb | KPeg.CodeGenerator.output_header | def output_header(code)
if header = @grammar.directives['header']
code << header.action.strip
code << "\n"
end
pre_class = @grammar.directives['pre-class']
if @standalone
if pre_class
code << pre_class.action.strip
code << "\n"
end
co... | ruby | def output_header(code)
if header = @grammar.directives['header']
code << header.action.strip
code << "\n"
end
pre_class = @grammar.directives['pre-class']
if @standalone
if pre_class
code << pre_class.action.strip
code << "\n"
end
co... | [
"def",
"output_header",
"(",
"code",
")",
"if",
"header",
"=",
"@grammar",
".",
"directives",
"[",
"'header'",
"]",
"code",
"<<",
"header",
".",
"action",
".",
"strip",
"code",
"<<",
"\"\\n\"",
"end",
"pre_class",
"=",
"@grammar",
".",
"directives",
"[",
... | Output up to the user-defined setup actions | [
"Output",
"up",
"to",
"the",
"user",
"-",
"defined",
"setup",
"actions"
] | 7ebf2e58e1248ffcbd0fe2cb552cc3bd12466eb9 | https://github.com/evanphx/kpeg/blob/7ebf2e58e1248ffcbd0fe2cb552cc3bd12466eb9/lib/kpeg/code_generator.rb#L434-L470 |
21,980 | ynab/ynab-sdk-ruby | lib/ynab/api/transactions_api.rb | YNAB.TransactionsApi.create_transaction | def create_transaction(budget_id, data, opts = {})
data, _status_code, _headers = create_transaction_with_http_info(budget_id, data, opts)
data
end | ruby | def create_transaction(budget_id, data, opts = {})
data, _status_code, _headers = create_transaction_with_http_info(budget_id, data, opts)
data
end | [
"def",
"create_transaction",
"(",
"budget_id",
",",
"data",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"create_transaction_with_http_info",
"(",
"budget_id",
",",
"data",
",",
"opts",
")",
"data",
"end"
] | Create a single transaction or multiple transactions
Creates a single transaction or multiple transactions. If you provide a body containing a 'transaction' object, a single transaction will be created and if you provide a body containing a 'transactions' array, multiple transactions will be created.
@param budget_i... | [
"Create",
"a",
"single",
"transaction",
"or",
"multiple",
"transactions",
"Creates",
"a",
"single",
"transaction",
"or",
"multiple",
"transactions",
".",
"If",
"you",
"provide",
"a",
"body",
"containing",
"a",
"transaction",
"object",
"a",
"single",
"transaction",... | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/transactions_api.rb#L28-L31 |
21,981 | ynab/ynab-sdk-ruby | lib/ynab/api/transactions_api.rb | YNAB.TransactionsApi.get_transaction_by_id | def get_transaction_by_id(budget_id, transaction_id, opts = {})
data, _status_code, _headers = get_transaction_by_id_with_http_info(budget_id, transaction_id, opts)
data
end | ruby | def get_transaction_by_id(budget_id, transaction_id, opts = {})
data, _status_code, _headers = get_transaction_by_id_with_http_info(budget_id, transaction_id, opts)
data
end | [
"def",
"get_transaction_by_id",
"(",
"budget_id",
",",
"transaction_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_transaction_by_id_with_http_info",
"(",
"budget_id",
",",
"transaction_id",
",",
"opts",
")",
"data",
... | Single transaction
Returns a single transaction
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param transaction_id The id of the transaction
@param [Hash] opts the optional parameters
@return [TransactionResponse] | [
"Single",
"transaction",
"Returns",
"a",
"single",
"transaction"
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/transactions_api.rb#L86-L89 |
21,982 | ynab/ynab-sdk-ruby | lib/ynab/api/transactions_api.rb | YNAB.TransactionsApi.get_transactions | def get_transactions(budget_id, opts = {})
data, _status_code, _headers = get_transactions_with_http_info(budget_id, opts)
data
end | ruby | def get_transactions(budget_id, opts = {})
data, _status_code, _headers = get_transactions_with_http_info(budget_id, opts)
data
end | [
"def",
"get_transactions",
"(",
"budget_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_transactions_with_http_info",
"(",
"budget_id",
",",
"opts",
")",
"data",
"end"
] | List transactions
Returns budget transactions
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param [Hash] opts the optional parameters
@option opts [Date] :since_date If specified, only transactions on or after this date will be included. The date ... | [
"List",
"transactions",
"Returns",
"budget",
"transactions"
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/transactions_api.rb#L146-L149 |
21,983 | ynab/ynab-sdk-ruby | lib/ynab/api/transactions_api.rb | YNAB.TransactionsApi.get_transactions_by_account | def get_transactions_by_account(budget_id, account_id, opts = {})
data, _status_code, _headers = get_transactions_by_account_with_http_info(budget_id, account_id, opts)
data
end | ruby | def get_transactions_by_account(budget_id, account_id, opts = {})
data, _status_code, _headers = get_transactions_by_account_with_http_info(budget_id, account_id, opts)
data
end | [
"def",
"get_transactions_by_account",
"(",
"budget_id",
",",
"account_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_transactions_by_account_with_http_info",
"(",
"budget_id",
",",
"account_id",
",",
"opts",
")",
"dat... | List account transactions
Returns all transactions for a specified account
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param account_id The id of the account
@param [Hash] opts the optional parameters
@option opts [Date] :since_date If specified... | [
"List",
"account",
"transactions",
"Returns",
"all",
"transactions",
"for",
"a",
"specified",
"account"
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/transactions_api.rb#L211-L214 |
21,984 | ynab/ynab-sdk-ruby | lib/ynab/api/transactions_api.rb | YNAB.TransactionsApi.get_transactions_by_category | def get_transactions_by_category(budget_id, category_id, opts = {})
data, _status_code, _headers = get_transactions_by_category_with_http_info(budget_id, category_id, opts)
data
end | ruby | def get_transactions_by_category(budget_id, category_id, opts = {})
data, _status_code, _headers = get_transactions_by_category_with_http_info(budget_id, category_id, opts)
data
end | [
"def",
"get_transactions_by_category",
"(",
"budget_id",
",",
"category_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_transactions_by_category_with_http_info",
"(",
"budget_id",
",",
"category_id",
",",
"opts",
")",
... | List category transactions
Returns all transactions for a specified category
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param category_id The id of the category
@param [Hash] opts the optional parameters
@option opts [Date] :since_date If speci... | [
"List",
"category",
"transactions",
"Returns",
"all",
"transactions",
"for",
"a",
"specified",
"category"
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/transactions_api.rb#L281-L284 |
21,985 | ynab/ynab-sdk-ruby | lib/ynab/api/transactions_api.rb | YNAB.TransactionsApi.get_transactions_by_payee | def get_transactions_by_payee(budget_id, payee_id, opts = {})
data, _status_code, _headers = get_transactions_by_payee_with_http_info(budget_id, payee_id, opts)
data
end | ruby | def get_transactions_by_payee(budget_id, payee_id, opts = {})
data, _status_code, _headers = get_transactions_by_payee_with_http_info(budget_id, payee_id, opts)
data
end | [
"def",
"get_transactions_by_payee",
"(",
"budget_id",
",",
"payee_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_transactions_by_payee_with_http_info",
"(",
"budget_id",
",",
"payee_id",
",",
"opts",
")",
"data",
"e... | List payee transactions
Returns all transactions for a specified payee
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param payee_id The id of the payee
@param [Hash] opts the optional parameters
@option opts [Date] :since_date If specified, only t... | [
"List",
"payee",
"transactions",
"Returns",
"all",
"transactions",
"for",
"a",
"specified",
"payee"
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/transactions_api.rb#L351-L354 |
21,986 | ynab/ynab-sdk-ruby | lib/ynab/api/transactions_api.rb | YNAB.TransactionsApi.update_transaction | def update_transaction(budget_id, transaction_id, data, opts = {})
data, _status_code, _headers = update_transaction_with_http_info(budget_id, transaction_id, data, opts)
data
end | ruby | def update_transaction(budget_id, transaction_id, data, opts = {})
data, _status_code, _headers = update_transaction_with_http_info(budget_id, transaction_id, data, opts)
data
end | [
"def",
"update_transaction",
"(",
"budget_id",
",",
"transaction_id",
",",
"data",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"update_transaction_with_http_info",
"(",
"budget_id",
",",
"transaction_id",
",",
"data",
",",... | Updates an existing transaction
Updates a transaction
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param transaction_id The id of the transaction
@param data The transaction to update
@param [Hash] opts the optional parameters
@return [Transacti... | [
"Updates",
"an",
"existing",
"transaction",
"Updates",
"a",
"transaction"
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/transactions_api.rb#L419-L422 |
21,987 | ynab/ynab-sdk-ruby | lib/ynab/api/transactions_api.rb | YNAB.TransactionsApi.update_transactions | def update_transactions(budget_id, data, opts = {})
data, _status_code, _headers = update_transactions_with_http_info(budget_id, data, opts)
data
end | ruby | def update_transactions(budget_id, data, opts = {})
data, _status_code, _headers = update_transactions_with_http_info(budget_id, data, opts)
data
end | [
"def",
"update_transactions",
"(",
"budget_id",
",",
"data",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"update_transactions_with_http_info",
"(",
"budget_id",
",",
"data",
",",
"opts",
")",
"data",
"end"
] | Update multiple transactions
Updates multiple transactions, by 'id' or 'import_id'.
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param data The transactions to update. Optionally, transaction 'id' value(s) can be specified as null and an &... | [
"Update",
"multiple",
"transactions",
"Updates",
"multiple",
"transactions",
"by",
"id",
"or",
"import_id",
"."
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/transactions_api.rb#L482-L485 |
21,988 | ynab/ynab-sdk-ruby | lib/ynab/api/accounts_api.rb | YNAB.AccountsApi.get_account_by_id | def get_account_by_id(budget_id, account_id, opts = {})
data, _status_code, _headers = get_account_by_id_with_http_info(budget_id, account_id, opts)
data
end | ruby | def get_account_by_id(budget_id, account_id, opts = {})
data, _status_code, _headers = get_account_by_id_with_http_info(budget_id, account_id, opts)
data
end | [
"def",
"get_account_by_id",
"(",
"budget_id",
",",
"account_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_account_by_id_with_http_info",
"(",
"budget_id",
",",
"account_id",
",",
"opts",
")",
"data",
"end"
] | Single account
Returns a single account
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param account_id The id of the account
@param [Hash] opts the optional parameters
@return [AccountResponse] | [
"Single",
"account",
"Returns",
"a",
"single",
"account"
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/accounts_api.rb#L28-L31 |
21,989 | ynab/ynab-sdk-ruby | lib/ynab/api/accounts_api.rb | YNAB.AccountsApi.get_accounts | def get_accounts(budget_id, opts = {})
data, _status_code, _headers = get_accounts_with_http_info(budget_id, opts)
data
end | ruby | def get_accounts(budget_id, opts = {})
data, _status_code, _headers = get_accounts_with_http_info(budget_id, opts)
data
end | [
"def",
"get_accounts",
"(",
"budget_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_accounts_with_http_info",
"(",
"budget_id",
",",
"opts",
")",
"data",
"end"
] | Account list
Returns all accounts
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param [Hash] opts the optional parameters
@option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed ... | [
"Account",
"list",
"Returns",
"all",
"accounts"
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/accounts_api.rb#L86-L89 |
21,990 | ynab/ynab-sdk-ruby | lib/ynab/api/months_api.rb | YNAB.MonthsApi.get_budget_month | def get_budget_month(budget_id, month, opts = {})
data, _status_code, _headers = get_budget_month_with_http_info(budget_id, month, opts)
data
end | ruby | def get_budget_month(budget_id, month, opts = {})
data, _status_code, _headers = get_budget_month_with_http_info(budget_id, month, opts)
data
end | [
"def",
"get_budget_month",
"(",
"budget_id",
",",
"month",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_budget_month_with_http_info",
"(",
"budget_id",
",",
"month",
",",
"opts",
")",
"data",
"end"
] | Single budget month
Returns a single budget month
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param month The budget month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC))
@param... | [
"Single",
"budget",
"month",
"Returns",
"a",
"single",
"budget",
"month"
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/months_api.rb#L28-L31 |
21,991 | ynab/ynab-sdk-ruby | lib/ynab/api/months_api.rb | YNAB.MonthsApi.get_budget_months | def get_budget_months(budget_id, opts = {})
data, _status_code, _headers = get_budget_months_with_http_info(budget_id, opts)
data
end | ruby | def get_budget_months(budget_id, opts = {})
data, _status_code, _headers = get_budget_months_with_http_info(budget_id, opts)
data
end | [
"def",
"get_budget_months",
"(",
"budget_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_budget_months_with_http_info",
"(",
"budget_id",
",",
"opts",
")",
"data",
"end"
] | List budget months
Returns all budget months
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param [Hash] opts the optional parameters
@option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that ha... | [
"List",
"budget",
"months",
"Returns",
"all",
"budget",
"months"
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/months_api.rb#L86-L89 |
21,992 | pioz/chess | lib/chess/pgn.rb | Chess.Pgn.to_s | def to_s
s = ''
TAGS.each do |t|
tag = instance_variable_get("@#{t}")
s << "[#{t.capitalize} \"#{tag}\"]\n"
end
s << "\n"
m = ''
@moves.each_with_index do |move, i|
m << "#{i/2+1}. " if i % 2 == 0
m << "#{move} "
end
m << @result unless @re... | ruby | def to_s
s = ''
TAGS.each do |t|
tag = instance_variable_get("@#{t}")
s << "[#{t.capitalize} \"#{tag}\"]\n"
end
s << "\n"
m = ''
@moves.each_with_index do |move, i|
m << "#{i/2+1}. " if i % 2 == 0
m << "#{move} "
end
m << @result unless @re... | [
"def",
"to_s",
"s",
"=",
"''",
"TAGS",
".",
"each",
"do",
"|",
"t",
"|",
"tag",
"=",
"instance_variable_get",
"(",
"\"@#{t}\"",
")",
"s",
"<<",
"\"[#{t.capitalize} \\\"#{tag}\\\"]\\n\"",
"end",
"s",
"<<",
"\"\\n\"",
"m",
"=",
"''",
"@moves",
".",
"each_wit... | PGN to string. | [
"PGN",
"to",
"string",
"."
] | 80744d1f351d45ecece8058e208c0f381a0569f5 | https://github.com/pioz/chess/blob/80744d1f351d45ecece8058e208c0f381a0569f5/lib/chess/pgn.rb#L76-L90 |
21,993 | pioz/chess | lib/chess/game.rb | Chess.Game.pgn | def pgn
pgn = Chess::Pgn.new
pgn.moves = self.moves
pgn.result = self.result
return pgn
end | ruby | def pgn
pgn = Chess::Pgn.new
pgn.moves = self.moves
pgn.result = self.result
return pgn
end | [
"def",
"pgn",
"pgn",
"=",
"Chess",
"::",
"Pgn",
".",
"new",
"pgn",
".",
"moves",
"=",
"self",
".",
"moves",
"pgn",
".",
"result",
"=",
"self",
".",
"result",
"return",
"pgn",
"end"
] | Returns the PGN rappresenting the game.
@return [String] | [
"Returns",
"the",
"PGN",
"rappresenting",
"the",
"game",
"."
] | 80744d1f351d45ecece8058e208c0f381a0569f5 | https://github.com/pioz/chess/blob/80744d1f351d45ecece8058e208c0f381a0569f5/lib/chess/game.rb#L154-L159 |
21,994 | ynab/ynab-sdk-ruby | lib/ynab/api/payee_locations_api.rb | YNAB.PayeeLocationsApi.get_payee_location_by_id | def get_payee_location_by_id(budget_id, payee_location_id, opts = {})
data, _status_code, _headers = get_payee_location_by_id_with_http_info(budget_id, payee_location_id, opts)
data
end | ruby | def get_payee_location_by_id(budget_id, payee_location_id, opts = {})
data, _status_code, _headers = get_payee_location_by_id_with_http_info(budget_id, payee_location_id, opts)
data
end | [
"def",
"get_payee_location_by_id",
"(",
"budget_id",
",",
"payee_location_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_payee_location_by_id_with_http_info",
"(",
"budget_id",
",",
"payee_location_id",
",",
"opts",
")"... | Single payee location
Returns a single payee location
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param payee_location_id id of payee location
@param [Hash] opts the optional parameters
@return [PayeeLocationResponse] | [
"Single",
"payee",
"location",
"Returns",
"a",
"single",
"payee",
"location"
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/payee_locations_api.rb#L28-L31 |
21,995 | ynab/ynab-sdk-ruby | lib/ynab/api/payee_locations_api.rb | YNAB.PayeeLocationsApi.get_payee_locations | def get_payee_locations(budget_id, opts = {})
data, _status_code, _headers = get_payee_locations_with_http_info(budget_id, opts)
data
end | ruby | def get_payee_locations(budget_id, opts = {})
data, _status_code, _headers = get_payee_locations_with_http_info(budget_id, opts)
data
end | [
"def",
"get_payee_locations",
"(",
"budget_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_payee_locations_with_http_info",
"(",
"budget_id",
",",
"opts",
")",
"data",
"end"
] | List payee locations
Returns all payee locations
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param [Hash] opts the optional parameters
@return [PayeeLocationsResponse] | [
"List",
"payee",
"locations",
"Returns",
"all",
"payee",
"locations"
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/payee_locations_api.rb#L85-L88 |
21,996 | ynab/ynab-sdk-ruby | lib/ynab/api/payee_locations_api.rb | YNAB.PayeeLocationsApi.get_payee_locations_by_payee | def get_payee_locations_by_payee(budget_id, payee_id, opts = {})
data, _status_code, _headers = get_payee_locations_by_payee_with_http_info(budget_id, payee_id, opts)
data
end | ruby | def get_payee_locations_by_payee(budget_id, payee_id, opts = {})
data, _status_code, _headers = get_payee_locations_by_payee_with_http_info(budget_id, payee_id, opts)
data
end | [
"def",
"get_payee_locations_by_payee",
"(",
"budget_id",
",",
"payee_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_payee_locations_by_payee_with_http_info",
"(",
"budget_id",
",",
"payee_id",
",",
"opts",
")",
"data"... | List locations for a payee
Returns all payee locations for the specified payee
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param payee_id id of payee
@param [Hash] opts the optional parameters
@return [PayeeLocationsResponse] | [
"List",
"locations",
"for",
"a",
"payee",
"Returns",
"all",
"payee",
"locations",
"for",
"the",
"specified",
"payee"
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/payee_locations_api.rb#L138-L141 |
21,997 | ynab/ynab-sdk-ruby | lib/ynab/api/categories_api.rb | YNAB.CategoriesApi.update_month_category | def update_month_category(budget_id, month, category_id, data, opts = {})
data, _status_code, _headers = update_month_category_with_http_info(budget_id, month, category_id, data, opts)
data
end | ruby | def update_month_category(budget_id, month, category_id, data, opts = {})
data, _status_code, _headers = update_month_category_with_http_info(budget_id, month, category_id, data, opts)
data
end | [
"def",
"update_month_category",
"(",
"budget_id",
",",
"month",
",",
"category_id",
",",
"data",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"update_month_category_with_http_info",
"(",
"budget_id",
",",
"month",
",",
"c... | Update a category for a specific month
Update a category for a specific month
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param month The budget month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current c... | [
"Update",
"a",
"category",
"for",
"a",
"specific",
"month",
"Update",
"a",
"category",
"for",
"a",
"specific",
"month"
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/categories_api.rb#L207-L210 |
21,998 | ynab/ynab-sdk-ruby | lib/ynab/api/budgets_api.rb | YNAB.BudgetsApi.get_budget_by_id | def get_budget_by_id(budget_id, opts = {})
data, _status_code, _headers = get_budget_by_id_with_http_info(budget_id, opts)
data
end | ruby | def get_budget_by_id(budget_id, opts = {})
data, _status_code, _headers = get_budget_by_id_with_http_info(budget_id, opts)
data
end | [
"def",
"get_budget_by_id",
"(",
"budget_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_budget_by_id_with_http_info",
"(",
"budget_id",
",",
"opts",
")",
"data",
"end"
] | Single budget
Returns a single budget with all related entities. This resource is effectively a full budget export.
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param [Hash] opts the optional parameters
@option opts [Integer] :last_knowledge_of_s... | [
"Single",
"budget",
"Returns",
"a",
"single",
"budget",
"with",
"all",
"related",
"entities",
".",
"This",
"resource",
"is",
"effectively",
"a",
"full",
"budget",
"export",
"."
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/budgets_api.rb#L28-L31 |
21,999 | ynab/ynab-sdk-ruby | lib/ynab/api/budgets_api.rb | YNAB.BudgetsApi.get_budget_settings_by_id | def get_budget_settings_by_id(budget_id, opts = {})
data, _status_code, _headers = get_budget_settings_by_id_with_http_info(budget_id, opts)
data
end | ruby | def get_budget_settings_by_id(budget_id, opts = {})
data, _status_code, _headers = get_budget_settings_by_id_with_http_info(budget_id, opts)
data
end | [
"def",
"get_budget_settings_by_id",
"(",
"budget_id",
",",
"opts",
"=",
"{",
"}",
")",
"data",
",",
"_status_code",
",",
"_headers",
"=",
"get_budget_settings_by_id_with_http_info",
"(",
"budget_id",
",",
"opts",
")",
"data",
"end"
] | Budget Settings
Returns settings for a budget
@param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
@param [Hash] opts the optional parameters
@return [BudgetSettingsResponse] | [
"Budget",
"Settings",
"Returns",
"settings",
"for",
"a",
"budget"
] | 389a959e482b6fa9643c7e7bfb55d8640cc952fd | https://github.com/ynab/ynab-sdk-ruby/blob/389a959e482b6fa9643c7e7bfb55d8640cc952fd/lib/ynab/api/budgets_api.rb#L82-L85 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.