id
int32
0
24.9k
repo
stringlengths
5
58
path
stringlengths
9
168
func_name
stringlengths
9
130
original_string
stringlengths
66
10.5k
language
stringclasses
1 value
code
stringlengths
66
10.5k
code_tokens
list
docstring
stringlengths
8
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
94
266
15,600
codeplant/simple-navigation
lib/simple_navigation/item_container.rb
SimpleNavigation.ItemContainer.level_for_item
def level_for_item(navi_key) return level if self[navi_key] items.each do |item| next unless item.sub_navigation level = item.sub_navigation.level_for_item(navi_key) return level if level end return nil end
ruby
def level_for_item(navi_key) return level if self[navi_key] items.each do |item| next unless item.sub_navigation level = item.sub_navigation.level_for_item(navi_key) return level if level end return nil end
[ "def", "level_for_item", "(", "navi_key", ")", "return", "level", "if", "self", "[", "navi_key", "]", "items", ".", "each", "do", "|", "item", "|", "next", "unless", "item", ".", "sub_navigation", "level", "=", "item", ".", "sub_navigation", ".", "level_fo...
Returns the level of the item specified by navi_key. Recursively works its way down the item's sub_navigations if the desired item is not found directly in this container's items. Returns nil if item cannot be found.
[ "Returns", "the", "level", "of", "the", "item", "specified", "by", "navi_key", ".", "Recursively", "works", "its", "way", "down", "the", "item", "s", "sub_navigations", "if", "the", "desired", "item", "is", "not", "found", "directly", "in", "this", "containe...
ed5b99744754b8f3dfca44c885df5aa938730b64
https://github.com/codeplant/simple-navigation/blob/ed5b99744754b8f3dfca44c885df5aa938730b64/lib/simple_navigation/item_container.rb#L89-L98
15,601
ueno/ruby-gpgme
lib/gpgme/key_common.rb
GPGME.KeyCommon.usable_for?
def usable_for?(purposes) unless purposes.kind_of? Array purposes = [purposes] end return false if [:revoked, :expired, :disabled, :invalid].include? trust return (purposes - capability).empty? end
ruby
def usable_for?(purposes) unless purposes.kind_of? Array purposes = [purposes] end return false if [:revoked, :expired, :disabled, :invalid].include? trust return (purposes - capability).empty? end
[ "def", "usable_for?", "(", "purposes", ")", "unless", "purposes", ".", "kind_of?", "Array", "purposes", "=", "[", "purposes", "]", "end", "return", "false", "if", "[", ":revoked", ",", ":expired", ",", ":disabled", ",", ":invalid", "]", ".", "include?", "t...
Checks if the key is capable of all of these actions. If empty array is passed then will return true. Returns false if the keys trust has been invalidated.
[ "Checks", "if", "the", "key", "is", "capable", "of", "all", "of", "these", "actions", ".", "If", "empty", "array", "is", "passed", "then", "will", "return", "true", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/key_common.rb#L31-L37
15,602
ueno/ruby-gpgme
lib/gpgme/data.rb
GPGME.Data.read
def read(length = nil) if length GPGME::gpgme_data_read(self, length) else buf = String.new loop do s = GPGME::gpgme_data_read(self, BLOCK_SIZE) break unless s buf << s end buf end end
ruby
def read(length = nil) if length GPGME::gpgme_data_read(self, length) else buf = String.new loop do s = GPGME::gpgme_data_read(self, BLOCK_SIZE) break unless s buf << s end buf end end
[ "def", "read", "(", "length", "=", "nil", ")", "if", "length", "GPGME", "::", "gpgme_data_read", "(", "self", ",", "length", ")", "else", "buf", "=", "String", ".", "new", "loop", "do", "s", "=", "GPGME", "::", "gpgme_data_read", "(", "self", ",", "B...
class << self Read at most +length+ bytes from the data object, or to the end of file if +length+ is omitted or is +nil+. @example data = GPGME::Data.new("From a string") data.read # => "From a string" @example data = GPGME::Data.new("From a string") data.read(4) # => "From"
[ "class", "<<", "self", "Read", "at", "most", "+", "length", "+", "bytes", "from", "the", "data", "object", "or", "to", "the", "end", "of", "file", "if", "+", "length", "+", "is", "omitted", "or", "is", "+", "nil", "+", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/data.rb#L112-L124
15,603
ueno/ruby-gpgme
lib/gpgme/data.rb
GPGME.Data.seek
def seek(offset, whence = IO::SEEK_SET) GPGME::gpgme_data_seek(self, offset, IO::SEEK_SET) end
ruby
def seek(offset, whence = IO::SEEK_SET) GPGME::gpgme_data_seek(self, offset, IO::SEEK_SET) end
[ "def", "seek", "(", "offset", ",", "whence", "=", "IO", "::", "SEEK_SET", ")", "GPGME", "::", "gpgme_data_seek", "(", "self", ",", "offset", ",", "IO", "::", "SEEK_SET", ")", "end" ]
Seek to a given +offset+ in the data object according to the value of +whence+. @example going to the beginning of the buffer after writing something data = GPGME::Data.new("Some data") data.read # => "Some data" data.read # => "" data.seek 0 data.read # => "Some data"
[ "Seek", "to", "a", "given", "+", "offset", "+", "in", "the", "data", "object", "according", "to", "the", "value", "of", "+", "whence", "+", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/data.rb#L137-L139
15,604
ueno/ruby-gpgme
lib/gpgme/data.rb
GPGME.Data.file_name=
def file_name=(file_name) err = GPGME::gpgme_data_set_file_name(self, file_name) exc = GPGME::error_to_exception(err) raise exc if exc file_name end
ruby
def file_name=(file_name) err = GPGME::gpgme_data_set_file_name(self, file_name) exc = GPGME::error_to_exception(err) raise exc if exc file_name end
[ "def", "file_name", "=", "(", "file_name", ")", "err", "=", "GPGME", "::", "gpgme_data_set_file_name", "(", "self", ",", "file_name", ")", "exc", "=", "GPGME", "::", "error_to_exception", "(", "err", ")", "raise", "exc", "if", "exc", "file_name", "end" ]
Sets the file name for this buffer. @raise [GPGME::Error::InvalidValue] if the value isn't accepted.
[ "Sets", "the", "file", "name", "for", "this", "buffer", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/data.rb#L197-L202
15,605
ueno/ruby-gpgme
lib/gpgme/key.rb
GPGME.Key.delete!
def delete!(allow_secret = false) GPGME::Ctx.new do |ctx| ctx.delete_key self, allow_secret end end
ruby
def delete!(allow_secret = false) GPGME::Ctx.new do |ctx| ctx.delete_key self, allow_secret end end
[ "def", "delete!", "(", "allow_secret", "=", "false", ")", "GPGME", "::", "Ctx", ".", "new", "do", "|", "ctx", "|", "ctx", ".", "delete_key", "self", ",", "allow_secret", "end", "end" ]
Delete this key. If it's public, and has a secret one it will fail unless +allow_secret+ is specified as true.
[ "Delete", "this", "key", ".", "If", "it", "s", "public", "and", "has", "a", "secret", "one", "it", "will", "fail", "unless", "+", "allow_secret", "+", "is", "specified", "as", "true", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/key.rb#L148-L152
15,606
ueno/ruby-gpgme
lib/gpgme/ctx.rb
GPGME.Ctx.protocol=
def protocol=(proto) err = GPGME::gpgme_set_protocol(self, proto) exc = GPGME::error_to_exception(err) raise exc if exc proto end
ruby
def protocol=(proto) err = GPGME::gpgme_set_protocol(self, proto) exc = GPGME::error_to_exception(err) raise exc if exc proto end
[ "def", "protocol", "=", "(", "proto", ")", "err", "=", "GPGME", "::", "gpgme_set_protocol", "(", "self", ",", "proto", ")", "exc", "=", "GPGME", "::", "error_to_exception", "(", "err", ")", "raise", "exc", "if", "exc", "proto", "end" ]
Getters and setters Set the +protocol+ used within this context. See {GPGME::Ctx.new} for possible values.
[ "Getters", "and", "setters" ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/ctx.rb#L108-L113
15,607
ueno/ruby-gpgme
lib/gpgme/ctx.rb
GPGME.Ctx.keylist_next
def keylist_next rkey = [] err = GPGME::gpgme_op_keylist_next(self, rkey) exc = GPGME::error_to_exception(err) raise exc if exc rkey[0] end
ruby
def keylist_next rkey = [] err = GPGME::gpgme_op_keylist_next(self, rkey) exc = GPGME::error_to_exception(err) raise exc if exc rkey[0] end
[ "def", "keylist_next", "rkey", "=", "[", "]", "err", "=", "GPGME", "::", "gpgme_op_keylist_next", "(", "self", ",", "rkey", ")", "exc", "=", "GPGME", "::", "error_to_exception", "(", "err", ")", "raise", "exc", "if", "exc", "rkey", "[", "0", "]", "end"...
Advance to the next key in the key listing operation. Used by {GPGME::Ctx#each_key}
[ "Advance", "to", "the", "next", "key", "in", "the", "key", "listing", "operation", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/ctx.rb#L281-L287
15,608
ueno/ruby-gpgme
lib/gpgme/ctx.rb
GPGME.Ctx.keylist_end
def keylist_end err = GPGME::gpgme_op_keylist_end(self) exc = GPGME::error_to_exception(err) raise exc if exc end
ruby
def keylist_end err = GPGME::gpgme_op_keylist_end(self) exc = GPGME::error_to_exception(err) raise exc if exc end
[ "def", "keylist_end", "err", "=", "GPGME", "::", "gpgme_op_keylist_end", "(", "self", ")", "exc", "=", "GPGME", "::", "error_to_exception", "(", "err", ")", "raise", "exc", "if", "exc", "end" ]
End a pending key list operation. Used by {GPGME::Ctx#each_key}
[ "End", "a", "pending", "key", "list", "operation", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/ctx.rb#L292-L296
15,609
ueno/ruby-gpgme
lib/gpgme/ctx.rb
GPGME.Ctx.each_key
def each_key(pattern = nil, secret_only = false, &block) keylist_start(pattern, secret_only) begin loop { yield keylist_next } rescue EOFError # The last key in the list has already been returned. ensure keylist_end end end
ruby
def each_key(pattern = nil, secret_only = false, &block) keylist_start(pattern, secret_only) begin loop { yield keylist_next } rescue EOFError # The last key in the list has already been returned. ensure keylist_end end end
[ "def", "each_key", "(", "pattern", "=", "nil", ",", "secret_only", "=", "false", ",", "&", "block", ")", "keylist_start", "(", "pattern", ",", "secret_only", ")", "begin", "loop", "{", "yield", "keylist_next", "}", "rescue", "EOFError", "# The last key in the ...
Convenient method to iterate over keys. If +pattern+ is +nil+, all available keys are returned. If +secret_only+ is +true+, only secret keys are returned. See {GPGME::Key.find} for an example of how to use, or for an easier way to use.
[ "Convenient", "method", "to", "iterate", "over", "keys", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/ctx.rb#L305-L314
15,610
ueno/ruby-gpgme
lib/gpgme/ctx.rb
GPGME.Ctx.keys
def keys(pattern = nil, secret_only = nil) keys = [] each_key(pattern, secret_only) do |key| keys << key end keys end
ruby
def keys(pattern = nil, secret_only = nil) keys = [] each_key(pattern, secret_only) do |key| keys << key end keys end
[ "def", "keys", "(", "pattern", "=", "nil", ",", "secret_only", "=", "nil", ")", "keys", "=", "[", "]", "each_key", "(", "pattern", ",", "secret_only", ")", "do", "|", "key", "|", "keys", "<<", "key", "end", "keys", "end" ]
Returns the keys that match the +pattern+, or all if +pattern+ is nil. Returns only secret keys if +secret_only+ is true.
[ "Returns", "the", "keys", "that", "match", "the", "+", "pattern", "+", "or", "all", "if", "+", "pattern", "+", "is", "nil", ".", "Returns", "only", "secret", "keys", "if", "+", "secret_only", "+", "is", "true", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/ctx.rb#L319-L325
15,611
ueno/ruby-gpgme
lib/gpgme/ctx.rb
GPGME.Ctx.get_key
def get_key(fingerprint, secret = false) rkey = [] err = GPGME::gpgme_get_key(self, fingerprint, rkey, secret ? 1 : 0) exc = GPGME::error_to_exception(err) raise exc if exc rkey[0] end
ruby
def get_key(fingerprint, secret = false) rkey = [] err = GPGME::gpgme_get_key(self, fingerprint, rkey, secret ? 1 : 0) exc = GPGME::error_to_exception(err) raise exc if exc rkey[0] end
[ "def", "get_key", "(", "fingerprint", ",", "secret", "=", "false", ")", "rkey", "=", "[", "]", "err", "=", "GPGME", "::", "gpgme_get_key", "(", "self", ",", "fingerprint", ",", "rkey", ",", "secret", "?", "1", ":", "0", ")", "exc", "=", "GPGME", ":...
Get the key with the +fingerprint+. If +secret+ is +true+, secret key is returned.
[ "Get", "the", "key", "with", "the", "+", "fingerprint", "+", ".", "If", "+", "secret", "+", "is", "+", "true", "+", "secret", "key", "is", "returned", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/ctx.rb#L329-L335
15,612
ueno/ruby-gpgme
lib/gpgme/ctx.rb
GPGME.Ctx.import_keys
def import_keys(keydata) err = GPGME::gpgme_op_import(self, keydata) exc = GPGME::error_to_exception(err) raise exc if exc end
ruby
def import_keys(keydata) err = GPGME::gpgme_op_import(self, keydata) exc = GPGME::error_to_exception(err) raise exc if exc end
[ "def", "import_keys", "(", "keydata", ")", "err", "=", "GPGME", "::", "gpgme_op_import", "(", "self", ",", "keydata", ")", "exc", "=", "GPGME", "::", "error_to_exception", "(", "err", ")", "raise", "exc", "if", "exc", "end" ]
Add the keys in the data buffer to the key ring.
[ "Add", "the", "keys", "in", "the", "data", "buffer", "to", "the", "key", "ring", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/ctx.rb#L382-L386
15,613
ueno/ruby-gpgme
lib/gpgme/ctx.rb
GPGME.Ctx.delete_key
def delete_key(key, allow_secret = false) err = GPGME::gpgme_op_delete(self, key, allow_secret ? 1 : 0) exc = GPGME::error_to_exception(err) raise exc if exc end
ruby
def delete_key(key, allow_secret = false) err = GPGME::gpgme_op_delete(self, key, allow_secret ? 1 : 0) exc = GPGME::error_to_exception(err) raise exc if exc end
[ "def", "delete_key", "(", "key", ",", "allow_secret", "=", "false", ")", "err", "=", "GPGME", "::", "gpgme_op_delete", "(", "self", ",", "key", ",", "allow_secret", "?", "1", ":", "0", ")", "exc", "=", "GPGME", "::", "error_to_exception", "(", "err", "...
Delete the key from the key ring. If allow_secret is false, only public keys are deleted, otherwise secret keys are deleted as well.
[ "Delete", "the", "key", "from", "the", "key", "ring", ".", "If", "allow_secret", "is", "false", "only", "public", "keys", "are", "deleted", "otherwise", "secret", "keys", "are", "deleted", "as", "well", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/ctx.rb#L396-L400
15,614
ueno/ruby-gpgme
lib/gpgme/ctx.rb
GPGME.Ctx.edit_key
def edit_key(key, editfunc, hook_value = nil, out = Data.new) err = GPGME::gpgme_op_edit(self, key, editfunc, hook_value, out) exc = GPGME::error_to_exception(err) raise exc if exc end
ruby
def edit_key(key, editfunc, hook_value = nil, out = Data.new) err = GPGME::gpgme_op_edit(self, key, editfunc, hook_value, out) exc = GPGME::error_to_exception(err) raise exc if exc end
[ "def", "edit_key", "(", "key", ",", "editfunc", ",", "hook_value", "=", "nil", ",", "out", "=", "Data", ".", "new", ")", "err", "=", "GPGME", "::", "gpgme_op_edit", "(", "self", ",", "key", ",", "editfunc", ",", "hook_value", ",", "out", ")", "exc", ...
Edit attributes of the key in the local key ring.
[ "Edit", "attributes", "of", "the", "key", "in", "the", "local", "key", "ring", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/ctx.rb#L404-L408
15,615
ueno/ruby-gpgme
lib/gpgme/ctx.rb
GPGME.Ctx.edit_card_key
def edit_card_key(key, editfunc, hook_value = nil, out = Data.new) err = GPGME::gpgme_op_card_edit(self, key, editfunc, hook_value, out) exc = GPGME::error_to_exception(err) raise exc if exc end
ruby
def edit_card_key(key, editfunc, hook_value = nil, out = Data.new) err = GPGME::gpgme_op_card_edit(self, key, editfunc, hook_value, out) exc = GPGME::error_to_exception(err) raise exc if exc end
[ "def", "edit_card_key", "(", "key", ",", "editfunc", ",", "hook_value", "=", "nil", ",", "out", "=", "Data", ".", "new", ")", "err", "=", "GPGME", "::", "gpgme_op_card_edit", "(", "self", ",", "key", ",", "editfunc", ",", "hook_value", ",", "out", ")",...
Edit attributes of the key on the card.
[ "Edit", "attributes", "of", "the", "key", "on", "the", "card", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/ctx.rb#L412-L416
15,616
ueno/ruby-gpgme
lib/gpgme/ctx.rb
GPGME.Ctx.verify
def verify(sig, signed_text = nil, plain = Data.new) err = GPGME::gpgme_op_verify(self, sig, signed_text, plain) exc = GPGME::error_to_exception(err) raise exc if exc plain end
ruby
def verify(sig, signed_text = nil, plain = Data.new) err = GPGME::gpgme_op_verify(self, sig, signed_text, plain) exc = GPGME::error_to_exception(err) raise exc if exc plain end
[ "def", "verify", "(", "sig", ",", "signed_text", "=", "nil", ",", "plain", "=", "Data", ".", "new", ")", "err", "=", "GPGME", "::", "gpgme_op_verify", "(", "self", ",", "sig", ",", "signed_text", ",", "plain", ")", "exc", "=", "GPGME", "::", "error_t...
Verify that the signature in the data object is a valid signature.
[ "Verify", "that", "the", "signature", "in", "the", "data", "object", "is", "a", "valid", "signature", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/ctx.rb#L444-L449
15,617
ueno/ruby-gpgme
lib/gpgme/ctx.rb
GPGME.Ctx.add_signer
def add_signer(*keys) keys.each do |key| err = GPGME::gpgme_signers_add(self, key) exc = GPGME::error_to_exception(err) raise exc if exc end end
ruby
def add_signer(*keys) keys.each do |key| err = GPGME::gpgme_signers_add(self, key) exc = GPGME::error_to_exception(err) raise exc if exc end end
[ "def", "add_signer", "(", "*", "keys", ")", "keys", ".", "each", "do", "|", "key", "|", "err", "=", "GPGME", "::", "gpgme_signers_add", "(", "self", ",", "key", ")", "exc", "=", "GPGME", "::", "error_to_exception", "(", "err", ")", "raise", "exc", "i...
Add _keys_ to the list of signers.
[ "Add", "_keys_", "to", "the", "list", "of", "signers", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/ctx.rb#L461-L467
15,618
ueno/ruby-gpgme
lib/gpgme/ctx.rb
GPGME.Ctx.sign
def sign(plain, sig = Data.new, mode = GPGME::SIG_MODE_NORMAL) err = GPGME::gpgme_op_sign(self, plain, sig, mode) exc = GPGME::error_to_exception(err) raise exc if exc sig end
ruby
def sign(plain, sig = Data.new, mode = GPGME::SIG_MODE_NORMAL) err = GPGME::gpgme_op_sign(self, plain, sig, mode) exc = GPGME::error_to_exception(err) raise exc if exc sig end
[ "def", "sign", "(", "plain", ",", "sig", "=", "Data", ".", "new", ",", "mode", "=", "GPGME", "::", "SIG_MODE_NORMAL", ")", "err", "=", "GPGME", "::", "gpgme_op_sign", "(", "self", ",", "plain", ",", "sig", ",", "mode", ")", "exc", "=", "GPGME", "::...
Create a signature for the text. +plain+ is a data object which contains the text. +sig+ is a data object where the generated signature is stored.
[ "Create", "a", "signature", "for", "the", "text", ".", "+", "plain", "+", "is", "a", "data", "object", "which", "contains", "the", "text", ".", "+", "sig", "+", "is", "a", "data", "object", "where", "the", "generated", "signature", "is", "stored", "." ...
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/ctx.rb#L472-L477
15,619
ueno/ruby-gpgme
lib/gpgme/ctx.rb
GPGME.Ctx.encrypt
def encrypt(recp, plain, cipher = Data.new, flags = 0) err = GPGME::gpgme_op_encrypt(self, recp, flags, plain, cipher) exc = GPGME::error_to_exception(err) raise exc if exc cipher end
ruby
def encrypt(recp, plain, cipher = Data.new, flags = 0) err = GPGME::gpgme_op_encrypt(self, recp, flags, plain, cipher) exc = GPGME::error_to_exception(err) raise exc if exc cipher end
[ "def", "encrypt", "(", "recp", ",", "plain", ",", "cipher", "=", "Data", ".", "new", ",", "flags", "=", "0", ")", "err", "=", "GPGME", "::", "gpgme_op_encrypt", "(", "self", ",", "recp", ",", "flags", ",", "plain", ",", "cipher", ")", "exc", "=", ...
Encrypt the plaintext in the data object for the recipients and return the ciphertext.
[ "Encrypt", "the", "plaintext", "in", "the", "data", "object", "for", "the", "recipients", "and", "return", "the", "ciphertext", "." ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/ctx.rb#L485-L490
15,620
ueno/ruby-gpgme
lib/gpgme/crypto.rb
GPGME.Crypto.encrypt
def encrypt(plain, options = {}) options = @default_options.merge options plain_data = Data.new(plain) cipher_data = Data.new(options[:output]) keys = Key.find(:public, options[:recipients]) keys = nil if options[:symmetric] flags = 0 flags |= GPGME::ENCRYPT_AL...
ruby
def encrypt(plain, options = {}) options = @default_options.merge options plain_data = Data.new(plain) cipher_data = Data.new(options[:output]) keys = Key.find(:public, options[:recipients]) keys = nil if options[:symmetric] flags = 0 flags |= GPGME::ENCRYPT_AL...
[ "def", "encrypt", "(", "plain", ",", "options", "=", "{", "}", ")", "options", "=", "@default_options", ".", "merge", "options", "plain_data", "=", "Data", ".", "new", "(", "plain", ")", "cipher_data", "=", "Data", ".", "new", "(", "options", "[", ":ou...
Encrypts an element crypto.encrypt something, options Will return a {GPGME::Data} element which can then be read. Must have some key imported, look for {GPGME::Key.import} to know how to import one, or the gpg documentation to know how to create one @param plain Must be something that can be converted into ...
[ "Encrypts", "an", "element" ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/crypto.rb#L79-L112
15,621
ueno/ruby-gpgme
lib/gpgme/crypto.rb
GPGME.Crypto.decrypt
def decrypt(cipher, options = {}) options = @default_options.merge options plain_data = Data.new(options[:output]) cipher_data = Data.new(cipher) GPGME::Ctx.new(options) do |ctx| begin ctx.decrypt_verify(cipher_data, plain_data) rescue GPGME::Error::UnsupportedAlgo...
ruby
def decrypt(cipher, options = {}) options = @default_options.merge options plain_data = Data.new(options[:output]) cipher_data = Data.new(cipher) GPGME::Ctx.new(options) do |ctx| begin ctx.decrypt_verify(cipher_data, plain_data) rescue GPGME::Error::UnsupportedAlgo...
[ "def", "decrypt", "(", "cipher", ",", "options", "=", "{", "}", ")", "options", "=", "@default_options", ".", "merge", "options", "plain_data", "=", "Data", ".", "new", "(", "options", "[", ":output", "]", ")", "cipher_data", "=", "Data", ".", "new", "...
Decrypts a previously encrypted element crypto.decrypt cipher, options, &block Must have the appropiate key to be able to decrypt, of course. Returns a {GPGME::Data} object which can then be read. @param cipher Must be something that can be converted into a {GPGME::Data} object, or a {GPGME::Data} object...
[ "Decrypts", "a", "previously", "encrypted", "element" ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/crypto.rb#L164-L192
15,622
ueno/ruby-gpgme
lib/gpgme/crypto.rb
GPGME.Crypto.sign
def sign(text, options = {}) options = @default_options.merge options plain = Data.new(text) output = Data.new(options[:output]) mode = options[:mode] || GPGME::SIG_MODE_NORMAL GPGME::Ctx.new(options) do |ctx| if options[:signer] signers = Key.find(:secret, options[:...
ruby
def sign(text, options = {}) options = @default_options.merge options plain = Data.new(text) output = Data.new(options[:output]) mode = options[:mode] || GPGME::SIG_MODE_NORMAL GPGME::Ctx.new(options) do |ctx| if options[:signer] signers = Key.find(:secret, options[:...
[ "def", "sign", "(", "text", ",", "options", "=", "{", "}", ")", "options", "=", "@default_options", ".", "merge", "options", "plain", "=", "Data", ".", "new", "(", "text", ")", "output", "=", "Data", ".", "new", "(", "options", "[", ":output", "]", ...
Creates a signature of a text crypto.sign text, options Must have the appropiate key to be able to decrypt, of course. Returns a {GPGME::Data} object which can then be read. @param text The object that will be signed. Must be something that can be converted to {GPGME::Data}. @param [Hash] options Opt...
[ "Creates", "a", "signature", "of", "a", "text" ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/crypto.rb#L235-L258
15,623
ueno/ruby-gpgme
lib/gpgme/crypto.rb
GPGME.Crypto.verify
def verify(sig, options = {}) options = @default_options.merge options sig = Data.new(sig) signed_text = Data.new(options[:signed_text]) output = Data.new(options[:output]) unless options[:signed_text] GPGME::Ctx.new(options) do |ctx| ctx.verify(sig, signed_text, out...
ruby
def verify(sig, options = {}) options = @default_options.merge options sig = Data.new(sig) signed_text = Data.new(options[:signed_text]) output = Data.new(options[:output]) unless options[:signed_text] GPGME::Ctx.new(options) do |ctx| ctx.verify(sig, signed_text, out...
[ "def", "verify", "(", "sig", ",", "options", "=", "{", "}", ")", "options", "=", "@default_options", ".", "merge", "options", "sig", "=", "Data", ".", "new", "(", "sig", ")", "signed_text", "=", "Data", ".", "new", "(", "options", "[", ":signed_text", ...
Verifies a previously signed element crypto.verify sig, options, &block Must have the proper keys available. @param sig The signature itself. Must be possible to convert into a {GPGME::Data} object, so can be a file. @param [Hash] options * +:signed_text+ if the sign is detached, then must be the pla...
[ "Verifies", "a", "previously", "signed", "element" ]
e84f42e2e8d956940c2430e5ccfbba9e989e3370
https://github.com/ueno/ruby-gpgme/blob/e84f42e2e8d956940c2430e5ccfbba9e989e3370/lib/gpgme/crypto.rb#L304-L322
15,624
mojombo/grit
lib/grit/index.rb
Grit.Index.add
def add(path, data) path = path.split('/') filename = path.pop current = self.tree path.each do |dir| current[dir] ||= {} node = current[dir] current = node end current[filename] = data end
ruby
def add(path, data) path = path.split('/') filename = path.pop current = self.tree path.each do |dir| current[dir] ||= {} node = current[dir] current = node end current[filename] = data end
[ "def", "add", "(", "path", ",", "data", ")", "path", "=", "path", ".", "split", "(", "'/'", ")", "filename", "=", "path", ".", "pop", "current", "=", "self", ".", "tree", "path", ".", "each", "do", "|", "dir", "|", "current", "[", "dir", "]", "...
Initialize a new Index object. repo - The Grit::Repo to which the index belongs. Returns the newly initialized Grit::Index. Public: Add a file to the index. path - The String file path including filename (no slash prefix). data - The String binary contents of the file. Returns nothing.
[ "Initialize", "a", "new", "Index", "object", "." ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/index.rb#L36-L49
15,625
mojombo/grit
lib/grit/index.rb
Grit.Index.write_tree
def write_tree(tree = nil, now_tree = nil) tree = self.tree if !tree tree_contents = {} # fill in original tree now_tree = read_tree(now_tree) if(now_tree && now_tree.is_a?(String)) now_tree.contents.each do |obj| sha = [obj.id].pack("H*") k = obj.name k += '/' if ...
ruby
def write_tree(tree = nil, now_tree = nil) tree = self.tree if !tree tree_contents = {} # fill in original tree now_tree = read_tree(now_tree) if(now_tree && now_tree.is_a?(String)) now_tree.contents.each do |obj| sha = [obj.id].pack("H*") k = obj.name k += '/' if ...
[ "def", "write_tree", "(", "tree", "=", "nil", ",", "now_tree", "=", "nil", ")", "tree", "=", "self", ".", "tree", "if", "!", "tree", "tree_contents", "=", "{", "}", "# fill in original tree", "now_tree", "=", "read_tree", "(", "now_tree", ")", "if", "(",...
Recursively write a tree to the index. tree - The Hash tree map: key - The String directory or filename. val - The Hash submap or the String contents of the file. now_tree - The Grit::Tree representing the a previous tree upon which this tree will be based (default: nil). Re...
[ "Recursively", "write", "a", "tree", "to", "the", "index", "." ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/index.rb#L165-L210
15,626
mojombo/grit
lib/grit/tree.rb
Grit.Tree.content_from_string
def content_from_string(repo, text) mode, type, id, name = text.split(/ |\t/, 4) case type when "tree" Tree.create(repo, :id => id, :mode => mode, :name => name) when "blob" Blob.create(repo, :id => id, :mode => mode, :name => name) when "link" Blob.crea...
ruby
def content_from_string(repo, text) mode, type, id, name = text.split(/ |\t/, 4) case type when "tree" Tree.create(repo, :id => id, :mode => mode, :name => name) when "blob" Blob.create(repo, :id => id, :mode => mode, :name => name) when "link" Blob.crea...
[ "def", "content_from_string", "(", "repo", ",", "text", ")", "mode", ",", "type", ",", "id", ",", "name", "=", "text", ".", "split", "(", "/", "\\t", "/", ",", "4", ")", "case", "type", "when", "\"tree\"", "Tree", ".", "create", "(", "repo", ",", ...
Parse a content item and create the appropriate object +repo+ is the Repo +text+ is the single line containing the items data in `git ls-tree` format Returns Grit::Blob or Grit::Tree
[ "Parse", "a", "content", "item", "and", "create", "the", "appropriate", "object", "+", "repo", "+", "is", "the", "Repo", "+", "text", "+", "is", "the", "single", "line", "containing", "the", "items", "data", "in", "git", "ls", "-", "tree", "format" ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/tree.rb#L67-L81
15,627
mojombo/grit
lib/grit/tree.rb
Grit.Tree./
def /(file) if file =~ /\// file.split("/").inject(self) { |acc, x| acc/x } rescue nil else self.contents.find { |c| c.name == file } end end
ruby
def /(file) if file =~ /\// file.split("/").inject(self) { |acc, x| acc/x } rescue nil else self.contents.find { |c| c.name == file } end end
[ "def", "/", "(", "file", ")", "if", "file", "=~", "/", "\\/", "/", "file", ".", "split", "(", "\"/\"", ")", ".", "inject", "(", "self", ")", "{", "|", "acc", ",", "x", "|", "acc", "/", "x", "}", "rescue", "nil", "else", "self", ".", "contents...
Find the named object in this tree's contents Examples Repo.new('/path/to/grit').tree/'lib' # => #<Grit::Tree "6cc23ee138be09ff8c28b07162720018b244e95e"> Repo.new('/path/to/grit').tree/'README.txt' # => #<Grit::Blob "8b1e02c0fb554eed2ce2ef737a68bb369d7527df"> Returns Grit::Blob or Grit::Tree or nil if n...
[ "Find", "the", "named", "object", "in", "this", "tree", "s", "contents" ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/tree.rb#L92-L98
15,628
mojombo/grit
lib/grit/submodule.rb
Grit.Submodule.create_initialize
def create_initialize(repo, atts) @repo = repo atts.each do |k, v| instance_variable_set("@#{k}".to_sym, v) end self end
ruby
def create_initialize(repo, atts) @repo = repo atts.each do |k, v| instance_variable_set("@#{k}".to_sym, v) end self end
[ "def", "create_initialize", "(", "repo", ",", "atts", ")", "@repo", "=", "repo", "atts", ".", "each", "do", "|", "k", ",", "v", "|", "instance_variable_set", "(", "\"@#{k}\"", ".", "to_sym", ",", "v", ")", "end", "self", "end" ]
Initializer for Submodule.create +repo+ is the Repo +atts+ is a Hash of instance variable data Returns Grit::Submodule
[ "Initializer", "for", "Submodule", ".", "create", "+", "repo", "+", "is", "the", "Repo", "+", "atts", "+", "is", "a", "Hash", "of", "instance", "variable", "data" ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/submodule.rb#L22-L28
15,629
mojombo/grit
lib/grit/submodule.rb
Grit.Submodule.url
def url(ref) config = self.class.config(@repo, ref) lookup = config.keys.inject({}) do |acc, key| id = config[key]['id'] acc[id] = config[key]['url'] acc end lookup[@id] end
ruby
def url(ref) config = self.class.config(@repo, ref) lookup = config.keys.inject({}) do |acc, key| id = config[key]['id'] acc[id] = config[key]['url'] acc end lookup[@id] end
[ "def", "url", "(", "ref", ")", "config", "=", "self", ".", "class", ".", "config", "(", "@repo", ",", "ref", ")", "lookup", "=", "config", ".", "keys", ".", "inject", "(", "{", "}", ")", "do", "|", "acc", ",", "key", "|", "id", "=", "config", ...
The url of this submodule +ref+ is the committish that should be used to look up the url Returns String
[ "The", "url", "of", "this", "submodule", "+", "ref", "+", "is", "the", "committish", "that", "should", "be", "used", "to", "look", "up", "the", "url" ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/submodule.rb#L34-L44
15,630
mojombo/grit
lib/grit/status.rb
Grit.Status.diff_files
def diff_files hsh = {} @base.git.diff_files.split("\n").each do |line| (info, file) = line.split("\t") (mode_src, mode_dest, sha_src, sha_dest, type) = info.split hsh[file] = {:path => file, :mode_file => mode_src.to_s[1, 7], :mode_index => mode_dest, ...
ruby
def diff_files hsh = {} @base.git.diff_files.split("\n").each do |line| (info, file) = line.split("\t") (mode_src, mode_dest, sha_src, sha_dest, type) = info.split hsh[file] = {:path => file, :mode_file => mode_src.to_s[1, 7], :mode_index => mode_dest, ...
[ "def", "diff_files", "hsh", "=", "{", "}", "@base", ".", "git", ".", "diff_files", ".", "split", "(", "\"\\n\"", ")", ".", "each", "do", "|", "line", "|", "(", "info", ",", "file", ")", "=", "line", ".", "split", "(", "\"\\t\"", ")", "(", "mode_s...
compares the index and the working directory
[ "compares", "the", "index", "and", "the", "working", "directory" ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/status.rb#L118-L127
15,631
mojombo/grit
lib/grit/actor.rb
Grit.Actor.output
def output(time) offset = time.utc_offset / 60 "%s <%s> %d %+.2d%.2d" % [ @name, @email || "null", time.to_i, offset / 60, offset.abs % 60] end
ruby
def output(time) offset = time.utc_offset / 60 "%s <%s> %d %+.2d%.2d" % [ @name, @email || "null", time.to_i, offset / 60, offset.abs % 60] end
[ "def", "output", "(", "time", ")", "offset", "=", "time", ".", "utc_offset", "/", "60", "\"%s <%s> %d %+.2d%.2d\"", "%", "[", "@name", ",", "@email", "||", "\"null\"", ",", "time", ".", "to_i", ",", "offset", "/", "60", ",", "offset", ".", "abs", "%", ...
Outputs an actor string for Git commits. actor = Actor.new('bob', 'bob@email.com') actor.output(time) # => "bob <bob@email.com> UNIX_TIME +0700" time - The Time the commit was authored or committed. Returns a String.
[ "Outputs", "an", "actor", "string", "for", "Git", "commits", "." ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/actor.rb#L36-L44
15,632
mojombo/grit
lib/grit/repo.rb
Grit.Repo.recent_tag_name
def recent_tag_name(committish = nil, options = {}) value = git.describe({:always => true}.update(options), committish.to_s).to_s.strip value.size.zero? ? nil : value end
ruby
def recent_tag_name(committish = nil, options = {}) value = git.describe({:always => true}.update(options), committish.to_s).to_s.strip value.size.zero? ? nil : value end
[ "def", "recent_tag_name", "(", "committish", "=", "nil", ",", "options", "=", "{", "}", ")", "value", "=", "git", ".", "describe", "(", "{", ":always", "=>", "true", "}", ".", "update", "(", "options", ")", ",", "committish", ".", "to_s", ")", ".", ...
Finds the most recent annotated tag name that is reachable from a commit. @repo.recent_tag_name('master') # => "v1.0-0-abcdef" committish - optional commit SHA, branch, or tag name. options - optional hash of options to pass to git. Default: {:always => true} :tags => true ...
[ "Finds", "the", "most", "recent", "annotated", "tag", "name", "that", "is", "reachable", "from", "a", "commit", "." ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/repo.rb#L300-L303
15,633
mojombo/grit
lib/grit/repo.rb
Grit.Repo.refs_list
def refs_list refs = self.git.for_each_ref refarr = refs.split("\n").map do |line| shatype, ref = line.split("\t") sha, type = shatype.split(' ') [ref, sha, type] end refarr end
ruby
def refs_list refs = self.git.for_each_ref refarr = refs.split("\n").map do |line| shatype, ref = line.split("\t") sha, type = shatype.split(' ') [ref, sha, type] end refarr end
[ "def", "refs_list", "refs", "=", "self", ".", "git", ".", "for_each_ref", "refarr", "=", "refs", ".", "split", "(", "\"\\n\"", ")", ".", "map", "do", "|", "line", "|", "shatype", ",", "ref", "=", "line", ".", "split", "(", "\"\\t\"", ")", "sha", ",...
returns an array of hashes representing all references
[ "returns", "an", "array", "of", "hashes", "representing", "all", "references" ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/repo.rb#L350-L358
15,634
mojombo/grit
lib/grit/repo.rb
Grit.Repo.commit_deltas_from
def commit_deltas_from(other_repo, ref = "master", other_ref = "master") # TODO: we should be able to figure out the branch point, rather than # rev-list'ing the whole thing repo_refs = self.git.rev_list({}, ref).strip.split("\n") other_repo_refs = other_repo.git.rev_list({}, other_ref).st...
ruby
def commit_deltas_from(other_repo, ref = "master", other_ref = "master") # TODO: we should be able to figure out the branch point, rather than # rev-list'ing the whole thing repo_refs = self.git.rev_list({}, ref).strip.split("\n") other_repo_refs = other_repo.git.rev_list({}, other_ref).st...
[ "def", "commit_deltas_from", "(", "other_repo", ",", "ref", "=", "\"master\"", ",", "other_ref", "=", "\"master\"", ")", "# TODO: we should be able to figure out the branch point, rather than", "# rev-list'ing the whole thing", "repo_refs", "=", "self", ".", "git", ".", "re...
Returns a list of commits that is in +other_repo+ but not in self Returns Grit::Commit[]
[ "Returns", "a", "list", "of", "commits", "that", "is", "in", "+", "other_repo", "+", "but", "not", "in", "self" ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/repo.rb#L433-L442
15,635
mojombo/grit
lib/grit/repo.rb
Grit.Repo.log
def log(commit = 'master', path = nil, options = {}) default_options = {:pretty => "raw"} actual_options = default_options.merge(options) arg = path ? [commit, '--', path] : [commit] commits = self.git.log(actual_options, *arg) Commit.list_from_string(self, commits) end
ruby
def log(commit = 'master', path = nil, options = {}) default_options = {:pretty => "raw"} actual_options = default_options.merge(options) arg = path ? [commit, '--', path] : [commit] commits = self.git.log(actual_options, *arg) Commit.list_from_string(self, commits) end
[ "def", "log", "(", "commit", "=", "'master'", ",", "path", "=", "nil", ",", "options", "=", "{", "}", ")", "default_options", "=", "{", ":pretty", "=>", "\"raw\"", "}", "actual_options", "=", "default_options", ".", "merge", "(", "options", ")", "arg", ...
The commit log for a treeish Returns Grit::Commit[]
[ "The", "commit", "log", "for", "a", "treeish" ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/repo.rb#L541-L547
15,636
mojombo/grit
lib/grit/repo.rb
Grit.Repo.alternates=
def alternates=(alts) alts.each do |alt| unless File.exist?(alt) raise "Could not set alternates. Alternate path #{alt} must exist" end end if alts.empty? self.git.fs_write('objects/info/alternates', '') else self.git.fs_write('objects/info/alternates',...
ruby
def alternates=(alts) alts.each do |alt| unless File.exist?(alt) raise "Could not set alternates. Alternate path #{alt} must exist" end end if alts.empty? self.git.fs_write('objects/info/alternates', '') else self.git.fs_write('objects/info/alternates',...
[ "def", "alternates", "=", "(", "alts", ")", "alts", ".", "each", "do", "|", "alt", "|", "unless", "File", ".", "exist?", "(", "alt", ")", "raise", "\"Could not set alternates. Alternate path #{alt} must exist\"", "end", "end", "if", "alts", ".", "empty?", "sel...
Sets the alternates +alts+ is the Array of String paths representing the alternates Returns nothing
[ "Sets", "the", "alternates", "+", "alts", "+", "is", "the", "Array", "of", "String", "paths", "representing", "the", "alternates" ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/repo.rb#L663-L675
15,637
mojombo/grit
lib/grit/commit.rb
Grit.Commit.diffs
def diffs(options = {}) if parents.empty? show else self.class.diff(@repo, parents.first.id, @id, [], options) end end
ruby
def diffs(options = {}) if parents.empty? show else self.class.diff(@repo, parents.first.id, @id, [], options) end end
[ "def", "diffs", "(", "options", "=", "{", "}", ")", "if", "parents", ".", "empty?", "show", "else", "self", ".", "class", ".", "diff", "(", "@repo", ",", "parents", ".", "first", ".", "id", ",", "@id", ",", "[", "]", ",", "options", ")", "end", ...
Shows diffs between the commit's parent and the commit. options - An optional Hash of options, passed to Grit::Commit.diff. Returns Grit::Diff[] (baked)
[ "Shows", "diffs", "between", "the", "commit", "s", "parent", "and", "the", "commit", "." ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/commit.rb#L219-L225
15,638
mojombo/grit
lib/grit/git.rb
Grit.Git.fs_write
def fs_write(file, contents) path = File.join(self.git_dir, file) FileUtils.mkdir_p(File.dirname(path)) File.open(path, 'w') do |f| f.write(contents) end end
ruby
def fs_write(file, contents) path = File.join(self.git_dir, file) FileUtils.mkdir_p(File.dirname(path)) File.open(path, 'w') do |f| f.write(contents) end end
[ "def", "fs_write", "(", "file", ",", "contents", ")", "path", "=", "File", ".", "join", "(", "self", ".", "git_dir", ",", "file", ")", "FileUtils", ".", "mkdir_p", "(", "File", ".", "dirname", "(", "path", ")", ")", "File", ".", "open", "(", "path"...
Write a normal file to the filesystem. +file+ is the relative path from the Git dir +contents+ is the String content to be written Returns nothing
[ "Write", "a", "normal", "file", "to", "the", "filesystem", ".", "+", "file", "+", "is", "the", "relative", "path", "from", "the", "Git", "dir", "+", "contents", "+", "is", "the", "String", "content", "to", "be", "written" ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/git.rb#L128-L134
15,639
mojombo/grit
lib/grit/git.rb
Grit.Git.fs_move
def fs_move(from, to) FileUtils.mv(File.join(self.git_dir, from), File.join(self.git_dir, to)) end
ruby
def fs_move(from, to) FileUtils.mv(File.join(self.git_dir, from), File.join(self.git_dir, to)) end
[ "def", "fs_move", "(", "from", ",", "to", ")", "FileUtils", ".", "mv", "(", "File", ".", "join", "(", "self", ".", "git_dir", ",", "from", ")", ",", "File", ".", "join", "(", "self", ".", "git_dir", ",", "to", ")", ")", "end" ]
Move a normal file +from+ is the relative path to the current file +to+ is the relative path to the destination file Returns nothing
[ "Move", "a", "normal", "file", "+", "from", "+", "is", "the", "relative", "path", "to", "the", "current", "file", "+", "to", "+", "is", "the", "relative", "path", "to", "the", "destination", "file" ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/git.rb#L149-L151
15,640
mojombo/grit
lib/grit/git.rb
Grit.Git.fs_chmod
def fs_chmod(mode, file = '/') FileUtils.chmod_R(mode, File.join(self.git_dir, file)) end
ruby
def fs_chmod(mode, file = '/') FileUtils.chmod_R(mode, File.join(self.git_dir, file)) end
[ "def", "fs_chmod", "(", "mode", ",", "file", "=", "'/'", ")", "FileUtils", ".", "chmod_R", "(", "mode", ",", "File", ".", "join", "(", "self", ".", "git_dir", ",", "file", ")", ")", "end" ]
Chmod the the file or dir and everything beneath +file+ is the relative path from the Git dir Returns nothing
[ "Chmod", "the", "the", "file", "or", "dir", "and", "everything", "beneath", "+", "file", "+", "is", "the", "relative", "path", "from", "the", "Git", "dir" ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/git.rb#L165-L167
15,641
mojombo/grit
lib/grit/git.rb
Grit.Git.check_applies
def check_applies(options={}, head_sha=nil, applies_sha=nil) options, head_sha, applies_sha = {}, options, head_sha if !options.is_a?(Hash) options = options.dup options[:env] &&= options[:env].dup git_index = create_tempfile('index', true) (options[:env] ||= {}).merge!('GIT_INDEX_FILE' =...
ruby
def check_applies(options={}, head_sha=nil, applies_sha=nil) options, head_sha, applies_sha = {}, options, head_sha if !options.is_a?(Hash) options = options.dup options[:env] &&= options[:env].dup git_index = create_tempfile('index', true) (options[:env] ||= {}).merge!('GIT_INDEX_FILE' =...
[ "def", "check_applies", "(", "options", "=", "{", "}", ",", "head_sha", "=", "nil", ",", "applies_sha", "=", "nil", ")", "options", ",", "head_sha", ",", "applies_sha", "=", "{", "}", ",", "options", ",", "head_sha", "if", "!", "options", ".", "is_a?",...
Checks if the patch of a commit can be applied to the given head. options - grit command options hash head_sha - String SHA or ref to check the patch against. applies_sha - String SHA of the patch. The patch itself is retrieved with #get_patch. Returns 0 if the patch applies cleanly (accord...
[ "Checks", "if", "the", "patch", "of", "a", "commit", "can", "be", "applied", "to", "the", "given", "head", "." ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/git.rb#L207-L225
15,642
mojombo/grit
lib/grit/git.rb
Grit.Git.get_patch
def get_patch(options={}, applies_sha=nil) options, applies_sha = {}, options if !options.is_a?(Hash) options = options.dup options[:env] &&= options[:env].dup git_index = create_tempfile('index', true) (options[:env] ||= {}).merge!('GIT_INDEX_FILE' => git_index) native(:diff, opti...
ruby
def get_patch(options={}, applies_sha=nil) options, applies_sha = {}, options if !options.is_a?(Hash) options = options.dup options[:env] &&= options[:env].dup git_index = create_tempfile('index', true) (options[:env] ||= {}).merge!('GIT_INDEX_FILE' => git_index) native(:diff, opti...
[ "def", "get_patch", "(", "options", "=", "{", "}", ",", "applies_sha", "=", "nil", ")", "options", ",", "applies_sha", "=", "{", "}", ",", "options", "if", "!", "options", ".", "is_a?", "(", "Hash", ")", "options", "=", "options", ".", "dup", "option...
Gets a patch for a given SHA using `git diff`. options - grit command options hash applies_sha - String SHA to get the patch from, using this command: `git diff #{applies_sha}^ #{applies_sha}` Returns the String patch from `git diff`.
[ "Gets", "a", "patch", "for", "a", "given", "SHA", "using", "git", "diff", "." ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/git.rb#L234-L243
15,643
mojombo/grit
lib/grit/git.rb
Grit.Git.apply_patch
def apply_patch(options={}, head_sha=nil, patch=nil) options, head_sha, patch = {}, options, head_sha if !options.is_a?(Hash) options = options.dup options[:env] &&= options[:env].dup options[:raise] = true git_index = create_tempfile('index', true) (options[:env] ||= {}).merge!('GI...
ruby
def apply_patch(options={}, head_sha=nil, patch=nil) options, head_sha, patch = {}, options, head_sha if !options.is_a?(Hash) options = options.dup options[:env] &&= options[:env].dup options[:raise] = true git_index = create_tempfile('index', true) (options[:env] ||= {}).merge!('GI...
[ "def", "apply_patch", "(", "options", "=", "{", "}", ",", "head_sha", "=", "nil", ",", "patch", "=", "nil", ")", "options", ",", "head_sha", ",", "patch", "=", "{", "}", ",", "options", ",", "head_sha", "if", "!", "options", ".", "is_a?", "(", "Has...
Applies the given patch against the given SHA of the current repo. options - grit command hash head_sha - String SHA or ref to apply the patch to. patch - The String patch to apply. Get this from #get_patch. Returns the String Tree SHA on a successful patch application, or false.
[ "Applies", "the", "given", "patch", "against", "the", "given", "SHA", "of", "the", "current", "repo", "." ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/git.rb#L252-L268
15,644
mojombo/grit
lib/grit/git.rb
Grit.Git.native
def native(cmd, options = {}, *args, &block) args = args.first if args.size == 1 && args[0].is_a?(Array) args.map! { |a| a.to_s } args.reject! { |a| a.empty? } # special option arguments env = options.delete(:env) || {} raise_errors = options.delete(:raise) process_info...
ruby
def native(cmd, options = {}, *args, &block) args = args.first if args.size == 1 && args[0].is_a?(Array) args.map! { |a| a.to_s } args.reject! { |a| a.empty? } # special option arguments env = options.delete(:env) || {} raise_errors = options.delete(:raise) process_info...
[ "def", "native", "(", "cmd", ",", "options", "=", "{", "}", ",", "*", "args", ",", "&", "block", ")", "args", "=", "args", ".", "first", "if", "args", ".", "size", "==", "1", "&&", "args", "[", "0", "]", ".", "is_a?", "(", "Array", ")", "args...
Execute a git command, bypassing any library implementation. cmd - The name of the git command as a Symbol. Underscores are converted to dashes as in :rev_parse => 'rev-parse'. options - Command line option arguments passed to the git command. Single char keys are converted to short options (:a => -a). Mult...
[ "Execute", "a", "git", "command", "bypassing", "any", "library", "implementation", "." ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/git.rb#L313-L364
15,645
mojombo/grit
lib/grit/git.rb
Grit.Git.run
def run(prefix, cmd, postfix, options, args, &block) timeout = options.delete(:timeout) rescue nil timeout = true if timeout.nil? base = options.delete(:base) rescue nil base = true if base.nil? if input = options.delete(:input) block = lambda { |stdin| stdin.write(inpu...
ruby
def run(prefix, cmd, postfix, options, args, &block) timeout = options.delete(:timeout) rescue nil timeout = true if timeout.nil? base = options.delete(:base) rescue nil base = true if base.nil? if input = options.delete(:input) block = lambda { |stdin| stdin.write(inpu...
[ "def", "run", "(", "prefix", ",", "cmd", ",", "postfix", ",", "options", ",", "args", ",", "&", "block", ")", "timeout", "=", "options", ".", "delete", "(", ":timeout", ")", "rescue", "nil", "timeout", "=", "true", "if", "timeout", ".", "nil?", "base...
DEPRECATED OPEN3-BASED COMMAND EXECUTION
[ "DEPRECATED", "OPEN3", "-", "BASED", "COMMAND", "EXECUTION" ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/git.rb#L422-L450
15,646
mojombo/grit
lib/grit/git.rb
Grit.Git.transform_options
def transform_options(options) args = [] options.keys.each do |opt| if opt.to_s.size == 1 if options[opt] == true args << "-#{opt}" elsif options[opt] == false # ignore else val = options.delete(opt) args << "-#{opt.to_s} ...
ruby
def transform_options(options) args = [] options.keys.each do |opt| if opt.to_s.size == 1 if options[opt] == true args << "-#{opt}" elsif options[opt] == false # ignore else val = options.delete(opt) args << "-#{opt.to_s} ...
[ "def", "transform_options", "(", "options", ")", "args", "=", "[", "]", "options", ".", "keys", ".", "each", "do", "|", "opt", "|", "if", "opt", ".", "to_s", ".", "size", "==", "1", "if", "options", "[", "opt", "]", "==", "true", "args", "<<", "\...
Transform Ruby style options into git command line options +options+ is a hash of Ruby style options Returns String[] e.g. ["--max-count=10", "--header"]
[ "Transform", "Ruby", "style", "options", "into", "git", "command", "line", "options", "+", "options", "+", "is", "a", "hash", "of", "Ruby", "style", "options" ]
5608567286e64a1c55c5e7fcd415364e04f8986e
https://github.com/mojombo/grit/blob/5608567286e64a1c55c5e7fcd415364e04f8986e/lib/grit/git.rb#L474-L498
15,647
pact-foundation/pact-mock_service
lib/pact/consumer_contract/request_decorator.rb
Pact.RequestDecorator.body
def body if content_type_is_form && request.body.is_a?(Hash) URI.encode_www_form convert_hash_body_to_array_of_arrays else Pact::Reification.from_term(request.body) end end
ruby
def body if content_type_is_form && request.body.is_a?(Hash) URI.encode_www_form convert_hash_body_to_array_of_arrays else Pact::Reification.from_term(request.body) end end
[ "def", "body", "if", "content_type_is_form", "&&", "request", ".", "body", ".", "is_a?", "(", "Hash", ")", "URI", ".", "encode_www_form", "convert_hash_body_to_array_of_arrays", "else", "Pact", "::", "Reification", ".", "from_term", "(", "request", ".", "body", ...
This feels wrong to be checking the class type of the body Do this better somehow.
[ "This", "feels", "wrong", "to", "be", "checking", "the", "class", "type", "of", "the", "body", "Do", "this", "better", "somehow", "." ]
3c26b469cbb796fa0045bb617b64c41c6b13b547
https://github.com/pact-foundation/pact-mock_service/blob/3c26b469cbb796fa0045bb617b64c41c6b13b547/lib/pact/consumer_contract/request_decorator.rb#L49-L55
15,648
pact-foundation/pact-mock_service
lib/pact/consumer_contract/request_decorator.rb
Pact.RequestDecorator.convert_hash_body_to_array_of_arrays
def convert_hash_body_to_array_of_arrays arrays = [] request.body.keys.each do | key | [*request.body[key]].each do | value | arrays << [key, value] end end Pact::Reification.from_term(arrays) end
ruby
def convert_hash_body_to_array_of_arrays arrays = [] request.body.keys.each do | key | [*request.body[key]].each do | value | arrays << [key, value] end end Pact::Reification.from_term(arrays) end
[ "def", "convert_hash_body_to_array_of_arrays", "arrays", "=", "[", "]", "request", ".", "body", ".", "keys", ".", "each", "do", "|", "key", "|", "[", "request", ".", "body", "[", "key", "]", "]", ".", "each", "do", "|", "value", "|", "arrays", "<<", ...
This probably belongs somewhere else.
[ "This", "probably", "belongs", "somewhere", "else", "." ]
3c26b469cbb796fa0045bb617b64c41c6b13b547
https://github.com/pact-foundation/pact-mock_service/blob/3c26b469cbb796fa0045bb617b64c41c6b13b547/lib/pact/consumer_contract/request_decorator.rb#L62-L71
15,649
theforeman/foreman-tasks
app/services/foreman_tasks/proxy_selector.rb
ForemanTasks.ProxySelector.select_by_jobs_count
def select_by_jobs_count(proxies) exclude = @tasks.keys + @offline @tasks.merge!(get_counts(proxies - exclude)) next_proxy = @tasks.select { |proxy, _| proxies.include?(proxy) } .min_by { |_, job_count| job_count }.try(:first) @tasks[next_proxy] += 1 if next_proxy.presen...
ruby
def select_by_jobs_count(proxies) exclude = @tasks.keys + @offline @tasks.merge!(get_counts(proxies - exclude)) next_proxy = @tasks.select { |proxy, _| proxies.include?(proxy) } .min_by { |_, job_count| job_count }.try(:first) @tasks[next_proxy] += 1 if next_proxy.presen...
[ "def", "select_by_jobs_count", "(", "proxies", ")", "exclude", "=", "@tasks", ".", "keys", "+", "@offline", "@tasks", ".", "merge!", "(", "get_counts", "(", "proxies", "-", "exclude", ")", ")", "next_proxy", "=", "@tasks", ".", "select", "{", "|", "proxy",...
Get the least loaded proxy from the given list of proxies
[ "Get", "the", "least", "loaded", "proxy", "from", "the", "given", "list", "of", "proxies" ]
d99094fa99d6b34324e6c8d10da4d012675c6e36
https://github.com/theforeman/foreman-tasks/blob/d99094fa99d6b34324e6c8d10da4d012675c6e36/app/services/foreman_tasks/proxy_selector.rb#L33-L40
15,650
theforeman/foreman-tasks
app/models/foreman_tasks/lock.rb
ForemanTasks.Lock.colliding_locks
def colliding_locks task_ids = task.self_and_parents.map(&:id) colliding_locks_scope = Lock.active.where(Lock.arel_table[:task_id].not_in(task_ids)) colliding_locks_scope = colliding_locks_scope.where(name: name, resource_id: resourc...
ruby
def colliding_locks task_ids = task.self_and_parents.map(&:id) colliding_locks_scope = Lock.active.where(Lock.arel_table[:task_id].not_in(task_ids)) colliding_locks_scope = colliding_locks_scope.where(name: name, resource_id: resourc...
[ "def", "colliding_locks", "task_ids", "=", "task", ".", "self_and_parents", ".", "map", "(", ":id", ")", "colliding_locks_scope", "=", "Lock", ".", "active", ".", "where", "(", "Lock", ".", "arel_table", "[", ":task_id", "]", ".", "not_in", "(", "task_ids", ...
returns a scope of the locks colliding with this one
[ "returns", "a", "scope", "of", "the", "locks", "colliding", "with", "this", "one" ]
d99094fa99d6b34324e6c8d10da4d012675c6e36
https://github.com/theforeman/foreman-tasks/blob/d99094fa99d6b34324e6c8d10da4d012675c6e36/app/models/foreman_tasks/lock.rb#L53-L63
15,651
theforeman/foreman-tasks
app/models/foreman_tasks/remote_task.rb
ForemanTasks.RemoteTask.trigger
def trigger(proxy_action_name, input) response = begin proxy.trigger_task(proxy_action_name, input).merge('result' => 'success') rescue RestClient::Exception => e logger.warn "Could not trigger task on the smart proxy: #{e.message}" {} ...
ruby
def trigger(proxy_action_name, input) response = begin proxy.trigger_task(proxy_action_name, input).merge('result' => 'success') rescue RestClient::Exception => e logger.warn "Could not trigger task on the smart proxy: #{e.message}" {} ...
[ "def", "trigger", "(", "proxy_action_name", ",", "input", ")", "response", "=", "begin", "proxy", ".", "trigger_task", "(", "proxy_action_name", ",", "input", ")", ".", "merge", "(", "'result'", "=>", "'success'", ")", "rescue", "RestClient", "::", "Exception"...
Triggers a task on the proxy "the old way"
[ "Triggers", "a", "task", "on", "the", "proxy", "the", "old", "way" ]
d99094fa99d6b34324e6c8d10da4d012675c6e36
https://github.com/theforeman/foreman-tasks/blob/d99094fa99d6b34324e6c8d10da4d012675c6e36/app/models/foreman_tasks/remote_task.rb#L16-L25
15,652
theforeman/foreman-tasks
app/lib/actions/proxy_action.rb
Actions.ProxyAction.fill_continuous_output
def fill_continuous_output(continuous_output) failed_proxy_tasks.each do |failure_data| message = _('Initialization error: %s') % "#{failure_data[:exception_class]} - #{failure_data[:exception_message]}" continuous_output.add_output(message, 'debug', failure_data[:timestamp]) ...
ruby
def fill_continuous_output(continuous_output) failed_proxy_tasks.each do |failure_data| message = _('Initialization error: %s') % "#{failure_data[:exception_class]} - #{failure_data[:exception_message]}" continuous_output.add_output(message, 'debug', failure_data[:timestamp]) ...
[ "def", "fill_continuous_output", "(", "continuous_output", ")", "failed_proxy_tasks", ".", "each", "do", "|", "failure_data", "|", "message", "=", "_", "(", "'Initialization error: %s'", ")", "%", "\"#{failure_data[:exception_class]} - #{failure_data[:exception_message]}\"", ...
The proxy action is able to contribute to continuous output
[ "The", "proxy", "action", "is", "able", "to", "contribute", "to", "continuous", "output" ]
d99094fa99d6b34324e6c8d10da4d012675c6e36
https://github.com/theforeman/foreman-tasks/blob/d99094fa99d6b34324e6c8d10da4d012675c6e36/app/lib/actions/proxy_action.rb#L167-L173
15,653
theforeman/foreman-tasks
app/lib/actions/recurring_action.rb
Actions.RecurringAction.trigger_repeat
def trigger_repeat(execution_plan) request_id = ::Logging.mdc['request'] ::Logging.mdc['request'] = SecureRandom.uuid if execution_plan.delay_record && recurring_logic_task_group args = execution_plan.delay_record.args logic = recurring_logic_task_group.recurring_logic logic.tr...
ruby
def trigger_repeat(execution_plan) request_id = ::Logging.mdc['request'] ::Logging.mdc['request'] = SecureRandom.uuid if execution_plan.delay_record && recurring_logic_task_group args = execution_plan.delay_record.args logic = recurring_logic_task_group.recurring_logic logic.tr...
[ "def", "trigger_repeat", "(", "execution_plan", ")", "request_id", "=", "::", "Logging", ".", "mdc", "[", "'request'", "]", "::", "Logging", ".", "mdc", "[", "'request'", "]", "=", "SecureRandom", ".", "uuid", "if", "execution_plan", ".", "delay_record", "&&...
Hook to be called when a repetition needs to be triggered. This either happens when the plan goes into planned state or when it fails.
[ "Hook", "to", "be", "called", "when", "a", "repetition", "needs", "to", "be", "triggered", ".", "This", "either", "happens", "when", "the", "plan", "goes", "into", "planned", "state", "or", "when", "it", "fails", "." ]
d99094fa99d6b34324e6c8d10da4d012675c6e36
https://github.com/theforeman/foreman-tasks/blob/d99094fa99d6b34324e6c8d10da4d012675c6e36/app/lib/actions/recurring_action.rb#L14-L24
15,654
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/repos/following.rb
BitBucket.Repos::Following.followers
def followers(user_name, repo_name, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? normalize! params response = get_request("/1.0/repositories/#{user}/#{repo.downcase}/followers/", params) return response unless block...
ruby
def followers(user_name, repo_name, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? normalize! params response = get_request("/1.0/repositories/#{user}/#{repo.downcase}/followers/", params) return response unless block...
[ "def", "followers", "(", "user_name", ",", "repo_name", ",", "params", "=", "{", "}", ")", "_update_user_repo_params", "(", "user_name", ",", "repo_name", ")", "_validate_user_repo_params", "(", "user", ",", "repo", ")", "unless", "user?", "&&", "repo?", "norm...
List repo followers = Examples bitbucket = BitBucket.new :user => 'user-name', :repo => 'repo-name' bitbucket.repos.following.followers bitbucket.repos.following.followers { |watcher| ... }
[ "List", "repo", "followers" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/repos/following.rb#L13-L21
15,655
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/repos/following.rb
BitBucket.Repos::Following.followed
def followed(*args) params = args.extract_options! normalize! params response = get_request("/1.0/user/follows", params) return response unless block_given? response.each { |el| yield el } end
ruby
def followed(*args) params = args.extract_options! normalize! params response = get_request("/1.0/user/follows", params) return response unless block_given? response.each { |el| yield el } end
[ "def", "followed", "(", "*", "args", ")", "params", "=", "args", ".", "extract_options!", "normalize!", "params", "response", "=", "get_request", "(", "\"/1.0/user/follows\"", ",", "params", ")", "return", "response", "unless", "block_given?", "response", ".", "...
List repos being followed by the authenticated user = Examples bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...' bitbucket.repos.following.followed
[ "List", "repos", "being", "followed", "by", "the", "authenticated", "user" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/repos/following.rb#L29-L36
15,656
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/repos/components.rb
BitBucket.Repos::Components.get
def get(user_name, repo_name, component_id, params={}) update_and_validate_user_repo_params(user_name, repo_name) normalize! params get_request("/2.0/repositories/#{user}/#{repo.downcase}/components/#{component_id}", params) end
ruby
def get(user_name, repo_name, component_id, params={}) update_and_validate_user_repo_params(user_name, repo_name) normalize! params get_request("/2.0/repositories/#{user}/#{repo.downcase}/components/#{component_id}", params) end
[ "def", "get", "(", "user_name", ",", "repo_name", ",", "component_id", ",", "params", "=", "{", "}", ")", "update_and_validate_user_repo_params", "(", "user_name", ",", "repo_name", ")", "normalize!", "params", "get_request", "(", "\"/2.0/repositories/#{user}/#{repo.d...
Get a component by it's ID = Examples bitbucket = BitBucket.new bitbucket.repos.components.get 'user-name', 'repo-name', 1
[ "Get", "a", "component", "by", "it", "s", "ID" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/repos/components.rb#L29-L34
15,657
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/repos/services.rb
BitBucket.Repos::Services.create
def create(user_name, repo_name, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? normalize! params assert_required_keys(REQUIRED_KEY_PARAM_NAMES, params) post_request("/1.0/repositories/#{user}/#{repo.downcase}/service...
ruby
def create(user_name, repo_name, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? normalize! params assert_required_keys(REQUIRED_KEY_PARAM_NAMES, params) post_request("/1.0/repositories/#{user}/#{repo.downcase}/service...
[ "def", "create", "(", "user_name", ",", "repo_name", ",", "params", "=", "{", "}", ")", "_update_user_repo_params", "(", "user_name", ",", "repo_name", ")", "_validate_user_repo_params", "(", "user", ",", "repo", ")", "unless", "user?", "&&", "repo?", "normali...
Create a service = Inputs * <tt>:type</tt> - One of the supported services. The type is a case-insensitive value. = Examples bitbucket = BitBucket.new bitbucket.repos.services.create 'user-name', 'repo-name', "type" => "Basecamp", "Password" => "...", "Username" => "...", ...
[ "Create", "a", "service" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/repos/services.rb#L55-L62
15,658
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/repos/services.rb
BitBucket.Repos::Services.edit
def edit(user_name, repo_name, service_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of(service_id) normalize! params put_request("/1.0/repositories/#{user}/#{repo.downcase}/services/#{service...
ruby
def edit(user_name, repo_name, service_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of(service_id) normalize! params put_request("/1.0/repositories/#{user}/#{repo.downcase}/services/#{service...
[ "def", "edit", "(", "user_name", ",", "repo_name", ",", "service_id", ",", "params", "=", "{", "}", ")", "_update_user_repo_params", "(", "user_name", ",", "repo_name", ")", "_validate_user_repo_params", "(", "user", ",", "repo", ")", "unless", "user?", "&&", ...
Edit a service = Inputs * <tt>:type</tt> - One of the supported services. The type is a case-insensitive value. = Examples bitbucket = BitBucket.new bitbucket.repos.services.edit 'user-name', 'repo-name', 109172378, "type" => "Basecamp", "Password" => "...", "Username" => "......
[ "Edit", "a", "service" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/repos/services.rb#L77-L85
15,659
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/repos/default_reviewers.rb
BitBucket.Repos::DefaultReviewers.get
def get(user_name, repo_name, reviewer_username, params={}) update_and_validate_user_repo_params(user_name, repo_name) normalize! params get_request("/2.0/repositories/#{user_name}/#{repo_name}/default-reviewers/#{reviewer_username}", params) end
ruby
def get(user_name, repo_name, reviewer_username, params={}) update_and_validate_user_repo_params(user_name, repo_name) normalize! params get_request("/2.0/repositories/#{user_name}/#{repo_name}/default-reviewers/#{reviewer_username}", params) end
[ "def", "get", "(", "user_name", ",", "repo_name", ",", "reviewer_username", ",", "params", "=", "{", "}", ")", "update_and_validate_user_repo_params", "(", "user_name", ",", "repo_name", ")", "normalize!", "params", "get_request", "(", "\"/2.0/repositories/#{user_name...
Get a default reviewer's info = Examples bitbucket = BitBucket.new bitbucket.repos.default_reviewers.get 'user-name', 'repo-name', 'reviewer-username'
[ "Get", "a", "default", "reviewer", "s", "info" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/repos/default_reviewers.rb#L27-L32
15,660
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/repos/default_reviewers.rb
BitBucket.Repos::DefaultReviewers.add
def add(user_name, repo_name, reviewer_username, params={}) update_and_validate_user_repo_params(user_name, repo_name) normalize! params put_request("/2.0/repositories/#{user_name}/#{repo_name}/default-reviewers/#{reviewer_username}", params) end
ruby
def add(user_name, repo_name, reviewer_username, params={}) update_and_validate_user_repo_params(user_name, repo_name) normalize! params put_request("/2.0/repositories/#{user_name}/#{repo_name}/default-reviewers/#{reviewer_username}", params) end
[ "def", "add", "(", "user_name", ",", "repo_name", ",", "reviewer_username", ",", "params", "=", "{", "}", ")", "update_and_validate_user_repo_params", "(", "user_name", ",", "repo_name", ")", "normalize!", "params", "put_request", "(", "\"/2.0/repositories/#{user_name...
Add a user to the default-reviewers list for the repo = Examples bitbucket = BitBucket.new bitbucket.repos.default_reviewers.add 'user-name', 'repo-name', 'reviewer-username'
[ "Add", "a", "user", "to", "the", "default", "-", "reviewers", "list", "for", "the", "repo" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/repos/default_reviewers.rb#L40-L45
15,661
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/repos/default_reviewers.rb
BitBucket.Repos::DefaultReviewers.remove
def remove(user_name, repo_name, reviewer_username, params={}) update_and_validate_user_repo_params(user_name, repo_name) normalize! params delete_request("/2.0/repositories/#{user_name}/#{repo_name}/default-reviewers/#{reviewer_username}", params) end
ruby
def remove(user_name, repo_name, reviewer_username, params={}) update_and_validate_user_repo_params(user_name, repo_name) normalize! params delete_request("/2.0/repositories/#{user_name}/#{repo_name}/default-reviewers/#{reviewer_username}", params) end
[ "def", "remove", "(", "user_name", ",", "repo_name", ",", "reviewer_username", ",", "params", "=", "{", "}", ")", "update_and_validate_user_repo_params", "(", "user_name", ",", "repo_name", ")", "normalize!", "params", "delete_request", "(", "\"/2.0/repositories/#{use...
Remove a user from the default-reviewers list for the repo = Examples bitbucket = BitBucket.new bitbucket.repos.default_reviewers.remove 'user-name', 'repo-name', 'reviewer-username'
[ "Remove", "a", "user", "from", "the", "default", "-", "reviewers", "list", "for", "the", "repo" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/repos/default_reviewers.rb#L53-L57
15,662
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/issues/components.rb
BitBucket.Issues::Components.get
def get(user_name, repo_name, component_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of component_id normalize! params get_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/components...
ruby
def get(user_name, repo_name, component_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of component_id normalize! params get_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/components...
[ "def", "get", "(", "user_name", ",", "repo_name", ",", "component_id", ",", "params", "=", "{", "}", ")", "_update_user_repo_params", "(", "user_name", ",", "repo_name", ")", "_validate_user_repo_params", "(", "user", ",", "repo", ")", "unless", "user?", "&&",...
Get a single component = Examples bitbucket = BitBucket.new bitbucket.issues.components.find 'user-name', 'repo-name', 'component-id'
[ "Get", "a", "single", "component" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/issues/components.rb#L36-L43
15,663
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/issues/components.rb
BitBucket.Issues::Components.update
def update(user_name, repo_name, component_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of component_id normalize! params filter! VALID_COMPONENT_INPUTS, params assert_required_keys(VALI...
ruby
def update(user_name, repo_name, component_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of component_id normalize! params filter! VALID_COMPONENT_INPUTS, params assert_required_keys(VALI...
[ "def", "update", "(", "user_name", ",", "repo_name", ",", "component_id", ",", "params", "=", "{", "}", ")", "_update_user_repo_params", "(", "user_name", ",", "repo_name", ")", "_validate_user_repo_params", "(", "user", ",", "repo", ")", "unless", "user?", "&...
Update a component = Inputs <tt>:name</tt> - Required string = Examples @bitbucket = BitBucket.new @bitbucket.issues.components.update 'user-name', 'repo-name', 'component-id', :name => 'API'
[ "Update", "a", "component" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/issues/components.rb#L76-L86
15,664
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/issues/components.rb
BitBucket.Issues::Components.delete
def delete(user_name, repo_name, component_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of component_id normalize! params delete_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/com...
ruby
def delete(user_name, repo_name, component_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of component_id normalize! params delete_request("/1.0/repositories/#{user}/#{repo.downcase}/issues/com...
[ "def", "delete", "(", "user_name", ",", "repo_name", ",", "component_id", ",", "params", "=", "{", "}", ")", "_update_user_repo_params", "(", "user_name", ",", "repo_name", ")", "_validate_user_repo_params", "(", "user", ",", "repo", ")", "unless", "user?", "&...
Delete a component = Examples bitbucket = BitBucket.new bitbucket.issues.components.delete 'user-name', 'repo-name', 'component-id'
[ "Delete", "a", "component" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/issues/components.rb#L95-L103
15,665
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/repos/keys.rb
BitBucket.Repos::Keys.create
def create(user_name, repo_name, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? normalize! params filter! VALID_KEY_PARAM_NAMES, params assert_required_keys(VALID_KEY_PARAM_NAMES, params) options = { headers: { ...
ruby
def create(user_name, repo_name, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? normalize! params filter! VALID_KEY_PARAM_NAMES, params assert_required_keys(VALID_KEY_PARAM_NAMES, params) options = { headers: { ...
[ "def", "create", "(", "user_name", ",", "repo_name", ",", "params", "=", "{", "}", ")", "_update_user_repo_params", "(", "user_name", ",", "repo_name", ")", "_validate_user_repo_params", "(", "user", ",", "repo", ")", "unless", "user?", "&&", "repo?", "normali...
Create a key = Inputs * <tt>:title</tt> - Required string. * <tt>:key</tt> - Required string. = Examples bitbucket = BitBucket.new bitbucket.repos.keys.create 'user-name', 'repo-name', "label" => "octocat@octomac", "key" => "ssh-rsa AAA..."
[ "Create", "a", "key" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/repos/keys.rb#L38-L47
15,666
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/repos/keys.rb
BitBucket.Repos::Keys.edit
def edit(user_name, repo_name, key_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of key_id normalize! params filter! VALID_KEY_PARAM_NAMES, params put_request("/1.0/repositories/#{user}/...
ruby
def edit(user_name, repo_name, key_id, params={}) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? _validate_presence_of key_id normalize! params filter! VALID_KEY_PARAM_NAMES, params put_request("/1.0/repositories/#{user}/...
[ "def", "edit", "(", "user_name", ",", "repo_name", ",", "key_id", ",", "params", "=", "{", "}", ")", "_update_user_repo_params", "(", "user_name", ",", "repo_name", ")", "_validate_user_repo_params", "(", "user", ",", "repo", ")", "unless", "user?", "&&", "r...
Edit a key = Inputs * <tt>:title</tt> - Required string. * <tt>:key</tt> - Required string. = Examples bitbucket = BitBucket.new bitbucket.repos.keys.edit 'user-name', 'repo-name', "label" => "octocat@octomac", "key" => "ssh-rsa AAA..."
[ "Edit", "a", "key" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/repos/keys.rb#L61-L70
15,667
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/teams.rb
BitBucket.Teams.members
def members(team_name) response = get_request("/2.0/teams/#{team_name.to_s}/members") return response["values"] unless block_given? response["values"].each { |el| yield el } end
ruby
def members(team_name) response = get_request("/2.0/teams/#{team_name.to_s}/members") return response["values"] unless block_given? response["values"].each { |el| yield el } end
[ "def", "members", "(", "team_name", ")", "response", "=", "get_request", "(", "\"/2.0/teams/#{team_name.to_s}/members\"", ")", "return", "response", "[", "\"values\"", "]", "unless", "block_given?", "response", "[", "\"values\"", "]", ".", "each", "{", "|", "el", ...
List members of the provided team = Examples bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...' bitbucket.teams.members(:team_name_here) bitbucket.teams.members(:team_name_here) { |member| ... }
[ "List", "members", "of", "the", "provided", "team" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/teams.rb#L42-L46
15,668
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/teams.rb
BitBucket.Teams.followers
def followers(team_name) response = get_request("/2.0/teams/#{team_name.to_s}/followers") return response["values"] unless block_given? response["values"].each { |el| yield el } end
ruby
def followers(team_name) response = get_request("/2.0/teams/#{team_name.to_s}/followers") return response["values"] unless block_given? response["values"].each { |el| yield el } end
[ "def", "followers", "(", "team_name", ")", "response", "=", "get_request", "(", "\"/2.0/teams/#{team_name.to_s}/followers\"", ")", "return", "response", "[", "\"values\"", "]", "unless", "block_given?", "response", "[", "\"values\"", "]", ".", "each", "{", "|", "e...
List followers of the provided team = Examples bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...' bitbucket.teams.followers(:team_name_here) bitbucket.teams.followers(:team_name_here) { |follower| ... }
[ "List", "followers", "of", "the", "provided", "team" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/teams.rb#L54-L58
15,669
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/teams.rb
BitBucket.Teams.following
def following(team_name) response = get_request("/2.0/teams/#{team_name.to_s}/following") return response["values"] unless block_given? response["values"].each { |el| yield el } end
ruby
def following(team_name) response = get_request("/2.0/teams/#{team_name.to_s}/following") return response["values"] unless block_given? response["values"].each { |el| yield el } end
[ "def", "following", "(", "team_name", ")", "response", "=", "get_request", "(", "\"/2.0/teams/#{team_name.to_s}/following\"", ")", "return", "response", "[", "\"values\"", "]", "unless", "block_given?", "response", "[", "\"values\"", "]", ".", "each", "{", "|", "e...
List accounts following the provided team = Examples bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...' bitbucket.teams.following(:team_name_here) bitbucket.teams.following(:team_name_here) { |followee| ... }
[ "List", "accounts", "following", "the", "provided", "team" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/teams.rb#L66-L70
15,670
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/teams.rb
BitBucket.Teams.repos
def repos(team_name) response = get_request("/2.0/repositories/#{team_name.to_s}") return response["values"] unless block_given? response["values"].each { |el| yield el } end
ruby
def repos(team_name) response = get_request("/2.0/repositories/#{team_name.to_s}") return response["values"] unless block_given? response["values"].each { |el| yield el } end
[ "def", "repos", "(", "team_name", ")", "response", "=", "get_request", "(", "\"/2.0/repositories/#{team_name.to_s}\"", ")", "return", "response", "[", "\"values\"", "]", "unless", "block_given?", "response", "[", "\"values\"", "]", ".", "each", "{", "|", "el", "...
List repos for provided team Private repos will only be returned if the user is authorized to view them = Examples bitbucket = BitBucket.new :oauth_token => '...', :oauth_secret => '...' bitbucket.teams.repos(:team_name_here) bitbucket.teams.repos(:team_name_here) { |repo| ... }
[ "List", "repos", "for", "provided", "team", "Private", "repos", "will", "only", "be", "returned", "if", "the", "user", "is", "authorized", "to", "view", "them" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/teams.rb#L79-L83
15,671
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/issues.rb
BitBucket.Issues.list_repo
def list_repo(user_name, repo_name, params={ }) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? normalize! params filter! VALID_ISSUE_PARAM_NAMES, params # _merge_mime_type(:issue, params) assert_valid_values(VALID_ISSUE_PA...
ruby
def list_repo(user_name, repo_name, params={ }) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? normalize! params filter! VALID_ISSUE_PARAM_NAMES, params # _merge_mime_type(:issue, params) assert_valid_values(VALID_ISSUE_PA...
[ "def", "list_repo", "(", "user_name", ",", "repo_name", ",", "params", "=", "{", "}", ")", "_update_user_repo_params", "(", "user_name", ",", "repo_name", ")", "_validate_user_repo_params", "(", "user", ",", "repo", ")", "unless", "user?", "&&", "repo?", "norm...
List issues for a repository = Inputs <tt>:limit</tt> - Optional - Number of issues to retrieve, default 15 <tt>:start</tt> - Optional - Issue offset, default 0 <tt>:search</tt> - Optional - A string to search for <tt>:sort</tt> - Optional - Sorts the output by any of the metadata fields <tt>:title</tt> - O...
[ "List", "issues", "for", "a", "repository" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/issues.rb#L76-L88
15,672
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/issues.rb
BitBucket.Issues.create
def create(user_name, repo_name, params={ }) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? normalize! params _merge_user_into_params!(params) unless params.has_key?('user') # _merge_mime_type(:issue, params) filter! VALID...
ruby
def create(user_name, repo_name, params={ }) _update_user_repo_params(user_name, repo_name) _validate_user_repo_params(user, repo) unless user? && repo? normalize! params _merge_user_into_params!(params) unless params.has_key?('user') # _merge_mime_type(:issue, params) filter! VALID...
[ "def", "create", "(", "user_name", ",", "repo_name", ",", "params", "=", "{", "}", ")", "_update_user_repo_params", "(", "user_name", ",", "repo_name", ")", "_validate_user_repo_params", "(", "user", ",", "repo", ")", "unless", "user?", "&&", "repo?", "normali...
Create an issue = Inputs <tt>:title</tt> - Required string <tt>:content</tt> - Optional string <tt>:responsible</tt> - Optional string - Login for the user that this issue should be assigned to. <tt>:milestone</tt> - Optional number - Milestone to associate this issue with <tt>:version</tt> - Optional numbe...
[ "Create", "an", "issue" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/issues.rb#L166-L177
15,673
bitbucket-rest-api/bitbucket
lib/bitbucket_rest_api/api.rb
BitBucket.API.method_missing
def method_missing(method, *args, &block) # :nodoc: case method.to_s when /^(.*)\?$/ return !self.send($1.to_s).nil? when /^clear_(.*)$/ self.send("#{$1.to_s}=", nil) else super end end
ruby
def method_missing(method, *args, &block) # :nodoc: case method.to_s when /^(.*)\?$/ return !self.send($1.to_s).nil? when /^clear_(.*)$/ self.send("#{$1.to_s}=", nil) else super end end
[ "def", "method_missing", "(", "method", ",", "*", "args", ",", "&", "block", ")", "# :nodoc:", "case", "method", ".", "to_s", "when", "/", "\\?", "/", "return", "!", "self", ".", "send", "(", "$1", ".", "to_s", ")", ".", "nil?", "when", "/", "/", ...
Responds to attribute query or attribute clear
[ "Responds", "to", "attribute", "query", "or", "attribute", "clear" ]
e03b6935104d59b3d9a922474c3dc210a5ef76d2
https://github.com/bitbucket-rest-api/bitbucket/blob/e03b6935104d59b3d9a922474c3dc210a5ef76d2/lib/bitbucket_rest_api/api.rb#L71-L80
15,674
janko/down
lib/down/utils.rb
Down.Utils.filename_from_content_disposition
def filename_from_content_disposition(content_disposition) content_disposition = content_disposition.to_s escaped_filename = content_disposition[/filename\*=UTF-8''(\S+)/, 1] || content_disposition[/filename="([^"]*)"/, 1] || content_disposition[/filename=(\S+)/, 1] filename ...
ruby
def filename_from_content_disposition(content_disposition) content_disposition = content_disposition.to_s escaped_filename = content_disposition[/filename\*=UTF-8''(\S+)/, 1] || content_disposition[/filename="([^"]*)"/, 1] || content_disposition[/filename=(\S+)/, 1] filename ...
[ "def", "filename_from_content_disposition", "(", "content_disposition", ")", "content_disposition", "=", "content_disposition", ".", "to_s", "escaped_filename", "=", "content_disposition", "[", "/", "\\*", "\\S", "/", ",", "1", "]", "||", "content_disposition", "[", "...
Retrieves potential filename from the "Content-Disposition" header.
[ "Retrieves", "potential", "filename", "from", "the", "Content", "-", "Disposition", "header", "." ]
300ed69edd4de2ea8298f1b43e99de091976fe93
https://github.com/janko/down/blob/300ed69edd4de2ea8298f1b43e99de091976fe93/lib/down/utils.rb#L8-L19
15,675
janko/down
lib/down/wget.rb
Down.Wget.download
def download(url, *args, max_size: nil, content_length_proc: nil, progress_proc: nil, destination: nil, **options) io = open(url, *args, **options, rewindable: false) content_length_proc.call(io.size) if content_length_proc && io.size if max_size && io.size && io.size > max_size raise Down::...
ruby
def download(url, *args, max_size: nil, content_length_proc: nil, progress_proc: nil, destination: nil, **options) io = open(url, *args, **options, rewindable: false) content_length_proc.call(io.size) if content_length_proc && io.size if max_size && io.size && io.size > max_size raise Down::...
[ "def", "download", "(", "url", ",", "*", "args", ",", "max_size", ":", "nil", ",", "content_length_proc", ":", "nil", ",", "progress_proc", ":", "nil", ",", "destination", ":", "nil", ",", "**", "options", ")", "io", "=", "open", "(", "url", ",", "ar...
Initializes the backend with common defaults. Downlods the remote file to disk. Accepts wget command-line options and some additional options as well.
[ "Initializes", "the", "backend", "with", "common", "defaults", ".", "Downlods", "the", "remote", "file", "to", "disk", ".", "Accepts", "wget", "command", "-", "line", "options", "and", "some", "additional", "options", "as", "well", "." ]
300ed69edd4de2ea8298f1b43e99de091976fe93
https://github.com/janko/down/blob/300ed69edd4de2ea8298f1b43e99de091976fe93/lib/down/wget.rb#L32-L68
15,676
janko/down
lib/down/wget.rb
Down.Wget.open
def open(url, *args, rewindable: true, **options) arguments = generate_command(url, *args, **options) command = Down::Wget::Command.execute(arguments) # Wrap the wget command output in an IO-like object. output = Down::ChunkedIO.new( chunks: command.enum_for(:output), on_cl...
ruby
def open(url, *args, rewindable: true, **options) arguments = generate_command(url, *args, **options) command = Down::Wget::Command.execute(arguments) # Wrap the wget command output in an IO-like object. output = Down::ChunkedIO.new( chunks: command.enum_for(:output), on_cl...
[ "def", "open", "(", "url", ",", "*", "args", ",", "rewindable", ":", "true", ",", "**", "options", ")", "arguments", "=", "generate_command", "(", "url", ",", "args", ",", "**", "options", ")", "command", "=", "Down", "::", "Wget", "::", "Command", "...
Starts retrieving the remote file and returns an IO-like object which downloads the response body on-demand. Accepts wget command-line options.
[ "Starts", "retrieving", "the", "remote", "file", "and", "returns", "an", "IO", "-", "like", "object", "which", "downloads", "the", "response", "body", "on", "-", "demand", ".", "Accepts", "wget", "command", "-", "line", "options", "." ]
300ed69edd4de2ea8298f1b43e99de091976fe93
https://github.com/janko/down/blob/300ed69edd4de2ea8298f1b43e99de091976fe93/lib/down/wget.rb#L72-L117
15,677
janko/down
lib/down/wget.rb
Down.Wget.generate_command
def generate_command(url, *args, **options) command = %W[wget --no-verbose --save-headers -O -] options = @arguments.grep(Hash).inject({}, :merge).merge(options) args = @arguments.grep(->(o){!o.is_a?(Hash)}) + args (args + options.to_a).each do |option, value| if option.is_a?(String...
ruby
def generate_command(url, *args, **options) command = %W[wget --no-verbose --save-headers -O -] options = @arguments.grep(Hash).inject({}, :merge).merge(options) args = @arguments.grep(->(o){!o.is_a?(Hash)}) + args (args + options.to_a).each do |option, value| if option.is_a?(String...
[ "def", "generate_command", "(", "url", ",", "*", "args", ",", "**", "options", ")", "command", "=", "%W[", "wget", "--no-verbose", "--save-headers", "-O", "-", "]", "options", "=", "@arguments", ".", "grep", "(", "Hash", ")", ".", "inject", "(", "{", "...
Generates the wget command.
[ "Generates", "the", "wget", "command", "." ]
300ed69edd4de2ea8298f1b43e99de091976fe93
https://github.com/janko/down/blob/300ed69edd4de2ea8298f1b43e99de091976fe93/lib/down/wget.rb#L122-L142
15,678
janko/down
lib/down/http.rb
Down.Http.download
def download(url, max_size: nil, progress_proc: nil, content_length_proc: nil, destination: nil, **options, &block) response = request(url, **options, &block) content_length_proc.call(response.content_length) if content_length_proc && response.content_length if max_size && response.content_length &&...
ruby
def download(url, max_size: nil, progress_proc: nil, content_length_proc: nil, destination: nil, **options, &block) response = request(url, **options, &block) content_length_proc.call(response.content_length) if content_length_proc && response.content_length if max_size && response.content_length &&...
[ "def", "download", "(", "url", ",", "max_size", ":", "nil", ",", "progress_proc", ":", "nil", ",", "content_length_proc", ":", "nil", ",", "destination", ":", "nil", ",", "**", "options", ",", "&", "block", ")", "response", "=", "request", "(", "url", ...
Initializes the backend with common defaults. Downlods the remote file to disk. Accepts HTTP.rb options via a hash or a block, and some additional options as well.
[ "Initializes", "the", "backend", "with", "common", "defaults", ".", "Downlods", "the", "remote", "file", "to", "disk", ".", "Accepts", "HTTP", ".", "rb", "options", "via", "a", "hash", "or", "a", "block", "and", "some", "additional", "options", "as", "well...
300ed69edd4de2ea8298f1b43e99de091976fe93
https://github.com/janko/down/blob/300ed69edd4de2ea8298f1b43e99de091976fe93/lib/down/http.rb#L33-L66
15,679
janko/down
lib/down/http.rb
Down.Http.open
def open(url, rewindable: true, **options, &block) response = request(url, **options, &block) Down::ChunkedIO.new( chunks: enum_for(:stream_body, response), size: response.content_length, encoding: response.content_type.charset, rewindable: rewindable, da...
ruby
def open(url, rewindable: true, **options, &block) response = request(url, **options, &block) Down::ChunkedIO.new( chunks: enum_for(:stream_body, response), size: response.content_length, encoding: response.content_type.charset, rewindable: rewindable, da...
[ "def", "open", "(", "url", ",", "rewindable", ":", "true", ",", "**", "options", ",", "&", "block", ")", "response", "=", "request", "(", "url", ",", "**", "options", ",", "block", ")", "Down", "::", "ChunkedIO", ".", "new", "(", "chunks", ":", "en...
Starts retrieving the remote file and returns an IO-like object which downloads the response body on-demand. Accepts HTTP.rb options via a hash or a block.
[ "Starts", "retrieving", "the", "remote", "file", "and", "returns", "an", "IO", "-", "like", "object", "which", "downloads", "the", "response", "body", "on", "-", "demand", ".", "Accepts", "HTTP", ".", "rb", "options", "via", "a", "hash", "or", "a", "bloc...
300ed69edd4de2ea8298f1b43e99de091976fe93
https://github.com/janko/down/blob/300ed69edd4de2ea8298f1b43e99de091976fe93/lib/down/http.rb#L71-L81
15,680
janko/down
lib/down/http.rb
Down.Http.stream_body
def stream_body(response, &block) response.body.each(&block) rescue => exception request_error!(exception) ensure response.connection.close unless @client.persistent? end
ruby
def stream_body(response, &block) response.body.each(&block) rescue => exception request_error!(exception) ensure response.connection.close unless @client.persistent? end
[ "def", "stream_body", "(", "response", ",", "&", "block", ")", "response", ".", "body", ".", "each", "(", "block", ")", "rescue", "=>", "exception", "request_error!", "(", "exception", ")", "ensure", "response", ".", "connection", ".", "close", "unless", "...
Yields chunks of the response body to the block.
[ "Yields", "chunks", "of", "the", "response", "body", "to", "the", "block", "." ]
300ed69edd4de2ea8298f1b43e99de091976fe93
https://github.com/janko/down/blob/300ed69edd4de2ea8298f1b43e99de091976fe93/lib/down/http.rb#L104-L110
15,681
janko/down
lib/down/net_http.rb
Down.NetHttp.download
def download(url, options = {}) options = @options.merge(options) max_size = options.delete(:max_size) max_redirects = options.delete(:max_redirects) progress_proc = options.delete(:progress_proc) content_length_proc = options.delete(:content_length_proc) dest...
ruby
def download(url, options = {}) options = @options.merge(options) max_size = options.delete(:max_size) max_redirects = options.delete(:max_redirects) progress_proc = options.delete(:progress_proc) content_length_proc = options.delete(:content_length_proc) dest...
[ "def", "download", "(", "url", ",", "options", "=", "{", "}", ")", "options", "=", "@options", ".", "merge", "(", "options", ")", "max_size", "=", "options", ".", "delete", "(", ":max_size", ")", "max_redirects", "=", "options", ".", "delete", "(", ":m...
Initializes the backend with common defaults. Downloads a remote file to disk using open-uri. Accepts any open-uri options, and a few more.
[ "Initializes", "the", "backend", "with", "common", "defaults", ".", "Downloads", "a", "remote", "file", "to", "disk", "using", "open", "-", "uri", ".", "Accepts", "any", "open", "-", "uri", "options", "and", "a", "few", "more", "." ]
300ed69edd4de2ea8298f1b43e99de091976fe93
https://github.com/janko/down/blob/300ed69edd4de2ea8298f1b43e99de091976fe93/lib/down/net_http.rb#L27-L94
15,682
janko/down
lib/down/net_http.rb
Down.NetHttp.ensure_uri
def ensure_uri(url, allow_relative: false) begin uri = URI(url) rescue URI::InvalidURIError => exception raise Down::InvalidUrl, exception.message end unless allow_relative && uri.relative? raise Down::InvalidUrl, "URL scheme needs to be http or https: #{uri}" unless uri...
ruby
def ensure_uri(url, allow_relative: false) begin uri = URI(url) rescue URI::InvalidURIError => exception raise Down::InvalidUrl, exception.message end unless allow_relative && uri.relative? raise Down::InvalidUrl, "URL scheme needs to be http or https: #{uri}" unless uri...
[ "def", "ensure_uri", "(", "url", ",", "allow_relative", ":", "false", ")", "begin", "uri", "=", "URI", "(", "url", ")", "rescue", "URI", "::", "InvalidURIError", "=>", "exception", "raise", "Down", "::", "InvalidUrl", ",", "exception", ".", "message", "end...
Checks that the url is a valid URI and that its scheme is http or https.
[ "Checks", "that", "the", "url", "is", "a", "valid", "URI", "and", "that", "its", "scheme", "is", "http", "or", "https", "." ]
300ed69edd4de2ea8298f1b43e99de091976fe93
https://github.com/janko/down/blob/300ed69edd4de2ea8298f1b43e99de091976fe93/lib/down/net_http.rb#L272-L284
15,683
janko/down
lib/down/net_http.rb
Down.NetHttp.addressable_normalize
def addressable_normalize(url) addressable_uri = Addressable::URI.parse(url) addressable_uri.normalize.to_s end
ruby
def addressable_normalize(url) addressable_uri = Addressable::URI.parse(url) addressable_uri.normalize.to_s end
[ "def", "addressable_normalize", "(", "url", ")", "addressable_uri", "=", "Addressable", "::", "URI", ".", "parse", "(", "url", ")", "addressable_uri", ".", "normalize", ".", "to_s", "end" ]
Makes sure that the URL is properly encoded.
[ "Makes", "sure", "that", "the", "URL", "is", "properly", "encoded", "." ]
300ed69edd4de2ea8298f1b43e99de091976fe93
https://github.com/janko/down/blob/300ed69edd4de2ea8298f1b43e99de091976fe93/lib/down/net_http.rb#L287-L290
15,684
janko/down
lib/down/backend.rb
Down.Backend.download_result
def download_result(tempfile, destination) return tempfile unless destination tempfile.close # required for Windows FileUtils.mv tempfile.path, destination nil end
ruby
def download_result(tempfile, destination) return tempfile unless destination tempfile.close # required for Windows FileUtils.mv tempfile.path, destination nil end
[ "def", "download_result", "(", "tempfile", ",", "destination", ")", "return", "tempfile", "unless", "destination", "tempfile", ".", "close", "# required for Windows", "FileUtils", ".", "mv", "tempfile", ".", "path", ",", "destination", "nil", "end" ]
If destination path is defined, move tempfile to the destination, otherwise return the tempfile unchanged.
[ "If", "destination", "path", "is", "defined", "move", "tempfile", "to", "the", "destination", "otherwise", "return", "the", "tempfile", "unchanged", "." ]
300ed69edd4de2ea8298f1b43e99de091976fe93
https://github.com/janko/down/blob/300ed69edd4de2ea8298f1b43e99de091976fe93/lib/down/backend.rb#L24-L31
15,685
tubedude/xirr
lib/xirr/newton_method.rb
Xirr.NewtonMethod.xirr
def xirr guess, options func = Function.new(self, :xnpv) rate = [guess || cf.irr_guess] begin nlsolve(func, rate) (rate[0] <= -1 || rate[0].nan?) ? nil : rate[0].round(Xirr::PRECISION) # rate[0].round(Xirr::PRECISION) rescue nil end end
ruby
def xirr guess, options func = Function.new(self, :xnpv) rate = [guess || cf.irr_guess] begin nlsolve(func, rate) (rate[0] <= -1 || rate[0].nan?) ? nil : rate[0].round(Xirr::PRECISION) # rate[0].round(Xirr::PRECISION) rescue nil end end
[ "def", "xirr", "guess", ",", "options", "func", "=", "Function", ".", "new", "(", "self", ",", ":xnpv", ")", "rate", "=", "[", "guess", "||", "cf", ".", "irr_guess", "]", "begin", "nlsolve", "(", "func", ",", "rate", ")", "(", "rate", "[", "0", "...
Calculates XIRR using Newton method @return [BigDecimal] @param guess [Float]
[ "Calculates", "XIRR", "using", "Newton", "method" ]
e8488a95b217c463d54a5d311ce02a9474f22f7e
https://github.com/tubedude/xirr/blob/e8488a95b217c463d54a5d311ce02a9474f22f7e/lib/xirr/newton_method.rb#L47-L58
15,686
tubedude/xirr
lib/xirr/bisection.rb
Xirr.Bisection.xirr
def xirr(midpoint, options) # Initial values left = [BigDecimal.new(-0.99999999, Xirr::PRECISION), cf.irr_guess].min right = [BigDecimal.new(9.99999999, Xirr::PRECISION), cf.irr_guess + 1].max @original_right = right midpoint ||= cf.irr_guess midpoint, runs = loop_rates(left, midp...
ruby
def xirr(midpoint, options) # Initial values left = [BigDecimal.new(-0.99999999, Xirr::PRECISION), cf.irr_guess].min right = [BigDecimal.new(9.99999999, Xirr::PRECISION), cf.irr_guess + 1].max @original_right = right midpoint ||= cf.irr_guess midpoint, runs = loop_rates(left, midp...
[ "def", "xirr", "(", "midpoint", ",", "options", ")", "# Initial values", "left", "=", "[", "BigDecimal", ".", "new", "(", "-", "0.99999999", ",", "Xirr", "::", "PRECISION", ")", ",", "cf", ".", "irr_guess", "]", ".", "min", "right", "=", "[", "BigDecim...
Calculates yearly Internal Rate of Return @return [BigDecimal] @param midpoint [Float] An initial guess rate will override the {Cashflow#irr_guess}
[ "Calculates", "yearly", "Internal", "Rate", "of", "Return" ]
e8488a95b217c463d54a5d311ce02a9474f22f7e
https://github.com/tubedude/xirr/blob/e8488a95b217c463d54a5d311ce02a9474f22f7e/lib/xirr/bisection.rb#L11-L23
15,687
tubedude/xirr
lib/xirr/base.rb
Xirr.Base.xnpv
def xnpv(rate) cf.inject(0) do |sum, t| sum + (xnpv_c rate, t.amount, periods_from_start(t.date)) end end
ruby
def xnpv(rate) cf.inject(0) do |sum, t| sum + (xnpv_c rate, t.amount, periods_from_start(t.date)) end end
[ "def", "xnpv", "(", "rate", ")", "cf", ".", "inject", "(", "0", ")", "do", "|", "sum", ",", "t", "|", "sum", "+", "(", "xnpv_c", "rate", ",", "t", ".", "amount", ",", "periods_from_start", "(", "t", ".", "date", ")", ")", "end", "end" ]
Net Present Value function that will be used to reduce the cashflow @param rate [BigDecimal] @return [BigDecimal]
[ "Net", "Present", "Value", "function", "that", "will", "be", "used", "to", "reduce", "the", "cashflow" ]
e8488a95b217c463d54a5d311ce02a9474f22f7e
https://github.com/tubedude/xirr/blob/e8488a95b217c463d54a5d311ce02a9474f22f7e/lib/xirr/base.rb#L25-L29
15,688
rake-compiler/rake-compiler
lib/rake/extensiontask.rb
Rake.ExtensionTask.define_staging_file_tasks
def define_staging_file_tasks(files, lib_path, stage_path, platf, ruby_ver) files.each do |gem_file| # ignore directories and the binary extension next if File.directory?(gem_file) || gem_file == "#{lib_path}/#{binary(platf)}" stage_file = "#{stage_path}/#{gem_file}" # copy each f...
ruby
def define_staging_file_tasks(files, lib_path, stage_path, platf, ruby_ver) files.each do |gem_file| # ignore directories and the binary extension next if File.directory?(gem_file) || gem_file == "#{lib_path}/#{binary(platf)}" stage_file = "#{stage_path}/#{gem_file}" # copy each f...
[ "def", "define_staging_file_tasks", "(", "files", ",", "lib_path", ",", "stage_path", ",", "platf", ",", "ruby_ver", ")", "files", ".", "each", "do", "|", "gem_file", "|", "# ignore directories and the binary extension", "next", "if", "File", ".", "directory?", "(...
copy other gem files to staging directory
[ "copy", "other", "gem", "files", "to", "staging", "directory" ]
18b335a87000efe91db8997f586772150528f342
https://github.com/rake-compiler/rake-compiler/blob/18b335a87000efe91db8997f586772150528f342/lib/rake/extensiontask.rb#L91-L108
15,689
rake-compiler/rake-compiler
lib/rake/javaextensiontask.rb
Rake.JavaExtensionTask.java_extdirs_arg
def java_extdirs_arg extdirs = Java::java.lang.System.getProperty('java.ext.dirs') rescue nil extdirs = ENV['JAVA_EXT_DIR'] unless extdirs java_extdir = extdirs.nil? ? "" : "-extdirs \"#{extdirs}\"" end
ruby
def java_extdirs_arg extdirs = Java::java.lang.System.getProperty('java.ext.dirs') rescue nil extdirs = ENV['JAVA_EXT_DIR'] unless extdirs java_extdir = extdirs.nil? ? "" : "-extdirs \"#{extdirs}\"" end
[ "def", "java_extdirs_arg", "extdirs", "=", "Java", "::", "java", ".", "lang", ".", "System", ".", "getProperty", "(", "'java.ext.dirs'", ")", "rescue", "nil", "extdirs", "=", "ENV", "[", "'JAVA_EXT_DIR'", "]", "unless", "extdirs", "java_extdir", "=", "extdirs"...
Discover Java Extension Directories and build an extdirs argument
[ "Discover", "Java", "Extension", "Directories", "and", "build", "an", "extdirs", "argument" ]
18b335a87000efe91db8997f586772150528f342
https://github.com/rake-compiler/rake-compiler/blob/18b335a87000efe91db8997f586772150528f342/lib/rake/javaextensiontask.rb#L190-L194
15,690
WinRb/WinRM
lib/winrm/connection.rb
WinRM.Connection.shell
def shell(shell_type, shell_opts = {}) shell = shell_factory.create_shell(shell_type, shell_opts) if block_given? begin yield shell ensure shell.close end else shell end end
ruby
def shell(shell_type, shell_opts = {}) shell = shell_factory.create_shell(shell_type, shell_opts) if block_given? begin yield shell ensure shell.close end else shell end end
[ "def", "shell", "(", "shell_type", ",", "shell_opts", "=", "{", "}", ")", "shell", "=", "shell_factory", ".", "create_shell", "(", "shell_type", ",", "shell_opts", ")", "if", "block_given?", "begin", "yield", "shell", "ensure", "shell", ".", "close", "end", ...
Creates a new shell on the remote Windows server associated with this connection. @param shell_type [Symbol] The shell type :cmd or :powershell @param shell_opts [Hash] Options targeted for the created shell @return [Shell] PowerShell or Cmd shell instance.
[ "Creates", "a", "new", "shell", "on", "the", "remote", "Windows", "server", "associated", "with", "this", "connection", "." ]
a5afd4755bd5a3e0672f6a6014448476f0631909
https://github.com/WinRb/WinRM/blob/a5afd4755bd5a3e0672f6a6014448476f0631909/lib/winrm/connection.rb#L38-L49
15,691
WinRb/WinRM
lib/winrm/connection.rb
WinRM.Connection.run_wql
def run_wql(wql, namespace = 'root/cimv2/*', &block) query = WinRM::WSMV::WqlQuery.new(transport, @connection_opts, wql, namespace) query.process_response(transport.send_request(query.build), &block) end
ruby
def run_wql(wql, namespace = 'root/cimv2/*', &block) query = WinRM::WSMV::WqlQuery.new(transport, @connection_opts, wql, namespace) query.process_response(transport.send_request(query.build), &block) end
[ "def", "run_wql", "(", "wql", ",", "namespace", "=", "'root/cimv2/*'", ",", "&", "block", ")", "query", "=", "WinRM", "::", "WSMV", "::", "WqlQuery", ".", "new", "(", "transport", ",", "@connection_opts", ",", "wql", ",", "namespace", ")", "query", ".", ...
Executes a WQL query against the WinRM connection @param wql [String] The wql query @param namespace [String] namespace for query - default is root/cimv2/* @return [Hash] Hash representation of wql query response (Hash is empty if a block is given) @yeild [type, item] Yields the time name and item for every item
[ "Executes", "a", "WQL", "query", "against", "the", "WinRM", "connection" ]
a5afd4755bd5a3e0672f6a6014448476f0631909
https://github.com/WinRb/WinRM/blob/a5afd4755bd5a3e0672f6a6014448476f0631909/lib/winrm/connection.rb#L56-L59
15,692
honeybadger-io/honeybadger-ruby
lib/honeybadger/config.rb
Honeybadger.Config.includes_token?
def includes_token?(obj, value) return false unless obj.kind_of?(Array) obj.map(&:to_sym).include?(value.to_sym) end
ruby
def includes_token?(obj, value) return false unless obj.kind_of?(Array) obj.map(&:to_sym).include?(value.to_sym) end
[ "def", "includes_token?", "(", "obj", ",", "value", ")", "return", "false", "unless", "obj", ".", "kind_of?", "(", "Array", ")", "obj", ".", "map", "(", ":to_sym", ")", ".", "include?", "(", "value", ".", "to_sym", ")", "end" ]
Takes an Array and a value and returns true if the value exists in the array in String or Symbol form, otherwise false.
[ "Takes", "an", "Array", "and", "a", "value", "and", "returns", "true", "if", "the", "value", "exists", "in", "the", "array", "in", "String", "or", "Symbol", "form", "otherwise", "false", "." ]
dc4af07c347814c2c8a71778c5bcd4d6979b4638
https://github.com/honeybadger-io/honeybadger-ruby/blob/dc4af07c347814c2c8a71778c5bcd4d6979b4638/lib/honeybadger/config.rb#L378-L381
15,693
honeybadger-io/honeybadger-ruby
lib/honeybadger/notice.rb
Honeybadger.Notice.ignore_by_class?
def ignore_by_class?(ignored_class = nil) @ignore_by_class ||= Proc.new do |ignored_class| case error_class when (ignored_class.respond_to?(:name) ? ignored_class.name : ignored_class) true else exception && ignored_class.is_a?(Class) && exception.class < ignored_class ...
ruby
def ignore_by_class?(ignored_class = nil) @ignore_by_class ||= Proc.new do |ignored_class| case error_class when (ignored_class.respond_to?(:name) ? ignored_class.name : ignored_class) true else exception && ignored_class.is_a?(Class) && exception.class < ignored_class ...
[ "def", "ignore_by_class?", "(", "ignored_class", "=", "nil", ")", "@ignore_by_class", "||=", "Proc", ".", "new", "do", "|", "ignored_class", "|", "case", "error_class", "when", "(", "ignored_class", ".", "respond_to?", "(", ":name", ")", "?", "ignored_class", ...
Determines if error class should be ignored. ignored_class_name - The name of the ignored class. May be a string or regexp (optional). Returns true or false.
[ "Determines", "if", "error", "class", "should", "be", "ignored", "." ]
dc4af07c347814c2c8a71778c5bcd4d6979b4638
https://github.com/honeybadger-io/honeybadger-ruby/blob/dc4af07c347814c2c8a71778c5bcd4d6979b4638/lib/honeybadger/notice.rb#L305-L316
15,694
honeybadger-io/honeybadger-ruby
lib/honeybadger/notice.rb
Honeybadger.Notice.construct_request_hash
def construct_request_hash request = { url: url, component: component, action: action, params: params, session: session, cgi_data: cgi_data, sanitizer: request_sanitizer } request.delete_if {|k,v| config.excluded_request_keys.include?(k) } ...
ruby
def construct_request_hash request = { url: url, component: component, action: action, params: params, session: session, cgi_data: cgi_data, sanitizer: request_sanitizer } request.delete_if {|k,v| config.excluded_request_keys.include?(k) } ...
[ "def", "construct_request_hash", "request", "=", "{", "url", ":", "url", ",", "component", ":", "component", ",", "action", ":", "action", ",", "params", ":", "params", ",", "session", ":", "session", ",", "cgi_data", ":", "cgi_data", ",", "sanitizer", ":"...
Construct the request data. Returns Hash request data.
[ "Construct", "the", "request", "data", "." ]
dc4af07c347814c2c8a71778c5bcd4d6979b4638
https://github.com/honeybadger-io/honeybadger-ruby/blob/dc4af07c347814c2c8a71778c5bcd4d6979b4638/lib/honeybadger/notice.rb#L331-L343
15,695
honeybadger-io/honeybadger-ruby
lib/honeybadger/notice.rb
Honeybadger.Notice.exception_context
def exception_context(exception) # This extra check exists because the exception itself is not expected to # convert to a hash. object = exception if exception.respond_to?(:to_honeybadger_context) object ||= {}.freeze Context(object) end
ruby
def exception_context(exception) # This extra check exists because the exception itself is not expected to # convert to a hash. object = exception if exception.respond_to?(:to_honeybadger_context) object ||= {}.freeze Context(object) end
[ "def", "exception_context", "(", "exception", ")", "# This extra check exists because the exception itself is not expected to", "# convert to a hash.", "object", "=", "exception", "if", "exception", ".", "respond_to?", "(", ":to_honeybadger_context", ")", "object", "||=", "{", ...
Get optional context from exception. Returns the Hash context.
[ "Get", "optional", "context", "from", "exception", "." ]
dc4af07c347814c2c8a71778c5bcd4d6979b4638
https://github.com/honeybadger-io/honeybadger-ruby/blob/dc4af07c347814c2c8a71778c5bcd4d6979b4638/lib/honeybadger/notice.rb#L348-L355
15,696
honeybadger-io/honeybadger-ruby
lib/honeybadger/notice.rb
Honeybadger.Notice.parse_backtrace
def parse_backtrace(backtrace) Backtrace.parse( backtrace, filters: construct_backtrace_filters(opts), config: config, source_radius: config[:'exceptions.source_radius'] ).to_a end
ruby
def parse_backtrace(backtrace) Backtrace.parse( backtrace, filters: construct_backtrace_filters(opts), config: config, source_radius: config[:'exceptions.source_radius'] ).to_a end
[ "def", "parse_backtrace", "(", "backtrace", ")", "Backtrace", ".", "parse", "(", "backtrace", ",", "filters", ":", "construct_backtrace_filters", "(", "opts", ")", ",", "config", ":", "config", ",", "source_radius", ":", "config", "[", ":'", "'", "]", ")", ...
Parse Backtrace from exception backtrace. backtrace - The Array backtrace from exception. Returns the Backtrace.
[ "Parse", "Backtrace", "from", "exception", "backtrace", "." ]
dc4af07c347814c2c8a71778c5bcd4d6979b4638
https://github.com/honeybadger-io/honeybadger-ruby/blob/dc4af07c347814c2c8a71778c5bcd4d6979b4638/lib/honeybadger/notice.rb#L443-L450
15,697
honeybadger-io/honeybadger-ruby
lib/honeybadger/notice.rb
Honeybadger.Notice.exception_cause
def exception_cause(exception) e = exception if e.respond_to?(:cause) && e.cause && e.cause.is_a?(Exception) e.cause elsif e.respond_to?(:original_exception) && e.original_exception && e.original_exception.is_a?(Exception) e.original_exception elsif e.respond_to?(:continued_excep...
ruby
def exception_cause(exception) e = exception if e.respond_to?(:cause) && e.cause && e.cause.is_a?(Exception) e.cause elsif e.respond_to?(:original_exception) && e.original_exception && e.original_exception.is_a?(Exception) e.original_exception elsif e.respond_to?(:continued_excep...
[ "def", "exception_cause", "(", "exception", ")", "e", "=", "exception", "if", "e", ".", "respond_to?", "(", ":cause", ")", "&&", "e", ".", "cause", "&&", "e", ".", "cause", ".", "is_a?", "(", "Exception", ")", "e", ".", "cause", "elsif", "e", ".", ...
Fetch cause from exception. exception - Exception to fetch cause from. Returns the Exception cause.
[ "Fetch", "cause", "from", "exception", "." ]
dc4af07c347814c2c8a71778c5bcd4d6979b4638
https://github.com/honeybadger-io/honeybadger-ruby/blob/dc4af07c347814c2c8a71778c5bcd4d6979b4638/lib/honeybadger/notice.rb#L468-L477
15,698
honeybadger-io/honeybadger-ruby
lib/honeybadger/notice.rb
Honeybadger.Notice.unwrap_causes
def unwrap_causes(cause) causes, c, i = [], cause, 0 while c && i < MAX_EXCEPTION_CAUSES causes << { class: c.class.name, message: c.message, backtrace: parse_backtrace(c.backtrace || caller) } i += 1 c = exception_cause(c) end caus...
ruby
def unwrap_causes(cause) causes, c, i = [], cause, 0 while c && i < MAX_EXCEPTION_CAUSES causes << { class: c.class.name, message: c.message, backtrace: parse_backtrace(c.backtrace || caller) } i += 1 c = exception_cause(c) end caus...
[ "def", "unwrap_causes", "(", "cause", ")", "causes", ",", "c", ",", "i", "=", "[", "]", ",", "cause", ",", "0", "while", "c", "&&", "i", "<", "MAX_EXCEPTION_CAUSES", "causes", "<<", "{", "class", ":", "c", ".", "class", ".", "name", ",", "message",...
Create a list of causes. cause - The first cause to unwrap. Returns Array causes (in Hash payload format).
[ "Create", "a", "list", "of", "causes", "." ]
dc4af07c347814c2c8a71778c5bcd4d6979b4638
https://github.com/honeybadger-io/honeybadger-ruby/blob/dc4af07c347814c2c8a71778c5bcd4d6979b4638/lib/honeybadger/notice.rb#L484-L498
15,699
honeybadger-io/honeybadger-ruby
lib/honeybadger/worker.rb
Honeybadger.Worker.flush
def flush mutex.synchronize do if thread && thread.alive? queue.push(marker) marker.wait(mutex) end end end
ruby
def flush mutex.synchronize do if thread && thread.alive? queue.push(marker) marker.wait(mutex) end end end
[ "def", "flush", "mutex", ".", "synchronize", "do", "if", "thread", "&&", "thread", ".", "alive?", "queue", ".", "push", "(", "marker", ")", "marker", ".", "wait", "(", "mutex", ")", "end", "end", "end" ]
Blocks until queue is processed up to this point in time.
[ "Blocks", "until", "queue", "is", "processed", "up", "to", "this", "point", "in", "time", "." ]
dc4af07c347814c2c8a71778c5bcd4d6979b4638
https://github.com/honeybadger-io/honeybadger-ruby/blob/dc4af07c347814c2c8a71778c5bcd4d6979b4638/lib/honeybadger/worker.rb#L96-L103