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
partition
stringclasses
1 value
arangamani/jenkins_api_client
lib/jenkins_api_client/client.rb
JenkinsApi.Client.get_config
def get_config(url_prefix) request = Net::HTTP::Get.new("#{@jenkins_path}#{url_prefix}/config.xml") @logger.debug "GET #{url_prefix}/config.xml" response = make_http_request(request) handle_exception(response, "body") end
ruby
def get_config(url_prefix) request = Net::HTTP::Get.new("#{@jenkins_path}#{url_prefix}/config.xml") @logger.debug "GET #{url_prefix}/config.xml" response = make_http_request(request) handle_exception(response, "body") end
[ "def", "get_config", "(", "url_prefix", ")", "request", "=", "Net", "::", "HTTP", "::", "Get", ".", "new", "(", "\"#{@jenkins_path}#{url_prefix}/config.xml\"", ")", "@logger", ".", "debug", "\"GET #{url_prefix}/config.xml\"", "response", "=", "make_http_request", "(",...
Obtains the configuration of a component from the Jenkins CI server @param [String] url_prefix The prefix to be used in the URL @return [String] XML configuration obtained from Jenkins
[ "Obtains", "the", "configuration", "of", "a", "component", "from", "the", "Jenkins", "CI", "server" ]
72f49f2e7ef12d58a0e33856ca91962b2e27709b
https://github.com/arangamani/jenkins_api_client/blob/72f49f2e7ef12d58a0e33856ca91962b2e27709b/lib/jenkins_api_client/client.rb#L486-L491
train
arangamani/jenkins_api_client
lib/jenkins_api_client/client.rb
JenkinsApi.Client.exec_cli
def exec_cli(command, args = []) base_dir = File.dirname(__FILE__) server_url = "http://#{@server_ip}:#{@server_port}/#{@jenkins_path}" cmd = "java -jar #{base_dir}/../../java_deps/jenkins-cli.jar -s #{server_url}" cmd << " -i #{@identity_file}" if @identity_file && !@identity_file.empty? ...
ruby
def exec_cli(command, args = []) base_dir = File.dirname(__FILE__) server_url = "http://#{@server_ip}:#{@server_port}/#{@jenkins_path}" cmd = "java -jar #{base_dir}/../../java_deps/jenkins-cli.jar -s #{server_url}" cmd << " -i #{@identity_file}" if @identity_file && !@identity_file.empty? ...
[ "def", "exec_cli", "(", "command", ",", "args", "=", "[", "]", ")", "base_dir", "=", "File", ".", "dirname", "(", "__FILE__", ")", "server_url", "=", "\"http://#{@server_ip}:#{@server_port}/#{@jenkins_path}\"", "cmd", "=", "\"java -jar #{base_dir}/../../java_deps/jenkin...
Execute the Jenkins CLI @param command [String] command name @param args [Array] the arguments for the command @return [String] command output from the CLI @raise [Exceptions::CLIException] if there are issues in running the commands using CLI
[ "Execute", "the", "Jenkins", "CLI" ]
72f49f2e7ef12d58a0e33856ca91962b2e27709b
https://github.com/arangamani/jenkins_api_client/blob/72f49f2e7ef12d58a0e33856ca91962b2e27709b/lib/jenkins_api_client/client.rb#L669-L693
train
arangamani/jenkins_api_client
lib/jenkins_api_client/client.rb
JenkinsApi.Client.symbolize_keys
def symbolize_keys(hash) hash.inject({}){|result, (key, value)| new_key = case key when String then key.to_sym else key end new_value = case value when Hash then symbolize_keys(value) else value end result[new_key] = new_value ...
ruby
def symbolize_keys(hash) hash.inject({}){|result, (key, value)| new_key = case key when String then key.to_sym else key end new_value = case value when Hash then symbolize_keys(value) else value end result[new_key] = new_value ...
[ "def", "symbolize_keys", "(", "hash", ")", "hash", ".", "inject", "(", "{", "}", ")", "{", "|", "result", ",", "(", "key", ",", "value", ")", "|", "new_key", "=", "case", "key", "when", "String", "then", "key", ".", "to_sym", "else", "key", "end", ...
Private method. Converts keys passed in as strings into symbols. @param hash [Hash] Hash containing arguments to login to jenkins.
[ "Private", "method", ".", "Converts", "keys", "passed", "in", "as", "strings", "into", "symbols", "." ]
72f49f2e7ef12d58a0e33856ca91962b2e27709b
https://github.com/arangamani/jenkins_api_client/blob/72f49f2e7ef12d58a0e33856ca91962b2e27709b/lib/jenkins_api_client/client.rb#L763-L776
train
arangamani/jenkins_api_client
lib/jenkins_api_client/client.rb
JenkinsApi.Client.handle_exception
def handle_exception(response, to_send = "code", send_json = false) msg = "HTTP Code: #{response.code}, Response Body: #{response.body}" @logger.debug msg case response.code.to_i # As of Jenkins version 1.519, the job builds return a 201 status code # with a Location HTTP header with the p...
ruby
def handle_exception(response, to_send = "code", send_json = false) msg = "HTTP Code: #{response.code}, Response Body: #{response.body}" @logger.debug msg case response.code.to_i # As of Jenkins version 1.519, the job builds return a 201 status code # with a Location HTTP header with the p...
[ "def", "handle_exception", "(", "response", ",", "to_send", "=", "\"code\"", ",", "send_json", "=", "false", ")", "msg", "=", "\"HTTP Code: #{response.code}, Response Body: #{response.body}\"", "@logger", ".", "debug", "msg", "case", "response", ".", "code", ".", "t...
Private method that handles the exception and raises with proper error message with the type of exception and returns the required values if no exceptions are raised. @param [Net::HTTP::Response] response Response from Jenkins @param [String] to_send What should be returned as a response. Allowed values: "code"...
[ "Private", "method", "that", "handles", "the", "exception", "and", "raises", "with", "proper", "error", "message", "with", "the", "type", "of", "exception", "and", "returns", "the", "required", "values", "if", "no", "exceptions", "are", "raised", "." ]
72f49f2e7ef12d58a0e33856ca91962b2e27709b
https://github.com/arangamani/jenkins_api_client/blob/72f49f2e7ef12d58a0e33856ca91962b2e27709b/lib/jenkins_api_client/client.rb#L800-L852
train
bugsnag/bugsnag-ruby
lib/bugsnag/report.rb
Bugsnag.Report.add_tab
def add_tab(name, value) return if name.nil? if value.is_a? Hash meta_data[name] ||= {} meta_data[name].merge! value else meta_data["custom"] = {} unless meta_data["custom"] meta_data["custom"][name.to_s] = value end end
ruby
def add_tab(name, value) return if name.nil? if value.is_a? Hash meta_data[name] ||= {} meta_data[name].merge! value else meta_data["custom"] = {} unless meta_data["custom"] meta_data["custom"][name.to_s] = value end end
[ "def", "add_tab", "(", "name", ",", "value", ")", "return", "if", "name", ".", "nil?", "if", "value", ".", "is_a?", "Hash", "meta_data", "[", "name", "]", "||=", "{", "}", "meta_data", "[", "name", "]", ".", "merge!", "value", "else", "meta_data", "[...
Initializes a new report from an exception. Add a new metadata tab to this notification.
[ "Initializes", "a", "new", "report", "from", "an", "exception", "." ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/report.rb#L67-L78
train
bugsnag/bugsnag-ruby
lib/bugsnag/report.rb
Bugsnag.Report.as_json
def as_json # Build the payload's exception event payload_event = { app: { version: app_version, releaseStage: release_stage, type: app_type }, context: context, device: { hostname: hostname }, exceptions: exceptions, ...
ruby
def as_json # Build the payload's exception event payload_event = { app: { version: app_version, releaseStage: release_stage, type: app_type }, context: context, device: { hostname: hostname }, exceptions: exceptions, ...
[ "def", "as_json", "# Build the payload's exception event", "payload_event", "=", "{", "app", ":", "{", "version", ":", "app_version", ",", "releaseStage", ":", "release_stage", ",", "type", ":", "app_type", "}", ",", "context", ":", "context", ",", "device", ":"...
Builds and returns the exception payload for this notification.
[ "Builds", "and", "returns", "the", "exception", "payload", "for", "this", "notification", "." ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/report.rb#L90-L135
train
bugsnag/bugsnag-ruby
lib/bugsnag/report.rb
Bugsnag.Report.summary
def summary # Guard against the exceptions array being removed/changed or emptied here if exceptions.respond_to?(:first) && exceptions.first { :error_class => exceptions.first[:errorClass], :message => exceptions.first[:message], :severity => severity } el...
ruby
def summary # Guard against the exceptions array being removed/changed or emptied here if exceptions.respond_to?(:first) && exceptions.first { :error_class => exceptions.first[:errorClass], :message => exceptions.first[:message], :severity => severity } el...
[ "def", "summary", "# Guard against the exceptions array being removed/changed or emptied here", "if", "exceptions", ".", "respond_to?", "(", ":first", ")", "&&", "exceptions", ".", "first", "{", ":error_class", "=>", "exceptions", ".", "first", "[", ":errorClass", "]", ...
Generates a summary to be attached as a breadcrumb @return [Hash] a Hash containing the report's error class, error message, and severity
[ "Generates", "a", "summary", "to", "be", "attached", "as", "a", "breadcrumb" ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/report.rb#L169-L183
train
bugsnag/bugsnag-ruby
lib/bugsnag/breadcrumbs/validator.rb
Bugsnag::Breadcrumbs.Validator.valid_meta_data_type?
def valid_meta_data_type?(value) value.nil? || value.is_a?(String) || value.is_a?(Numeric) || value.is_a?(FalseClass) || value.is_a?(TrueClass) end
ruby
def valid_meta_data_type?(value) value.nil? || value.is_a?(String) || value.is_a?(Numeric) || value.is_a?(FalseClass) || value.is_a?(TrueClass) end
[ "def", "valid_meta_data_type?", "(", "value", ")", "value", ".", "nil?", "||", "value", ".", "is_a?", "(", "String", ")", "||", "value", ".", "is_a?", "(", "Numeric", ")", "||", "value", ".", "is_a?", "(", "FalseClass", ")", "||", "value", ".", "is_a?"...
Tests whether the meta_data types are non-complex objects. Acceptable types are String, Numeric, TrueClass, FalseClass, and nil. @param value [Object] the object to be type checked
[ "Tests", "whether", "the", "meta_data", "types", "are", "non", "-", "complex", "objects", "." ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/breadcrumbs/validator.rb#L55-L57
train
bugsnag/bugsnag-ruby
lib/bugsnag/integrations/rack.rb
Bugsnag.Rack.call
def call(env) # Set the request data for bugsnag middleware to use Bugsnag.configuration.set_request_data(:rack_env, env) if Bugsnag.configuration.auto_capture_sessions Bugsnag.start_session end begin response = @app.call(env) rescue Exception => raised # Not...
ruby
def call(env) # Set the request data for bugsnag middleware to use Bugsnag.configuration.set_request_data(:rack_env, env) if Bugsnag.configuration.auto_capture_sessions Bugsnag.start_session end begin response = @app.call(env) rescue Exception => raised # Not...
[ "def", "call", "(", "env", ")", "# Set the request data for bugsnag middleware to use", "Bugsnag", ".", "configuration", ".", "set_request_data", "(", ":rack_env", ",", "env", ")", "if", "Bugsnag", ".", "configuration", ".", "auto_capture_sessions", "Bugsnag", ".", "s...
Wraps a call to the application with error capturing
[ "Wraps", "a", "call", "to", "the", "application", "with", "error", "capturing" ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/integrations/rack.rb#L38-L76
train
bugsnag/bugsnag-ruby
lib/bugsnag/session_tracker.rb
Bugsnag.SessionTracker.start_session
def start_session return unless Bugsnag.configuration.enable_sessions start_delivery_thread start_time = Time.now().utc().strftime('%Y-%m-%dT%H:%M:00') new_session = { :id => SecureRandom.uuid, :startedAt => start_time, :events => { :handled => 0, :unh...
ruby
def start_session return unless Bugsnag.configuration.enable_sessions start_delivery_thread start_time = Time.now().utc().strftime('%Y-%m-%dT%H:%M:00') new_session = { :id => SecureRandom.uuid, :startedAt => start_time, :events => { :handled => 0, :unh...
[ "def", "start_session", "return", "unless", "Bugsnag", ".", "configuration", ".", "enable_sessions", "start_delivery_thread", "start_time", "=", "Time", ".", "now", "(", ")", ".", "utc", "(", ")", ".", "strftime", "(", "'%Y-%m-%dT%H:%M:00'", ")", "new_session", ...
Initializes the session tracker. Starts a new session, storing it on the current thread. This allows Bugsnag to track error rates for a release.
[ "Initializes", "the", "session", "tracker", "." ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/session_tracker.rb#L37-L51
train
bugsnag/bugsnag-ruby
lib/bugsnag/session_tracker.rb
Bugsnag.SessionTracker.send_sessions
def send_sessions sessions = [] counts = @session_counts @session_counts = Concurrent::Hash.new(0) counts.each do |min, count| sessions << { :startedAt => min, :sessionsStarted => count } end deliver(sessions) end
ruby
def send_sessions sessions = [] counts = @session_counts @session_counts = Concurrent::Hash.new(0) counts.each do |min, count| sessions << { :startedAt => min, :sessionsStarted => count } end deliver(sessions) end
[ "def", "send_sessions", "sessions", "=", "[", "]", "counts", "=", "@session_counts", "@session_counts", "=", "Concurrent", "::", "Hash", ".", "new", "(", "0", ")", "counts", ".", "each", "do", "|", "min", ",", "count", "|", "sessions", "<<", "{", ":start...
Delivers the current session_counts lists to the session endpoint.
[ "Delivers", "the", "current", "session_counts", "lists", "to", "the", "session", "endpoint", "." ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/session_tracker.rb#L57-L68
train
bugsnag/bugsnag-ruby
lib/bugsnag/integrations/railtie.rb
Bugsnag.Railtie.event_subscription
def event_subscription(event) ActiveSupport::Notifications.subscribe(event[:id]) do |*, event_id, data| filtered_data = data.slice(*event[:allowed_data]) filtered_data[:event_name] = event[:id] filtered_data[:event_id] = event_id if event[:id] == "sql.active_record" binds...
ruby
def event_subscription(event) ActiveSupport::Notifications.subscribe(event[:id]) do |*, event_id, data| filtered_data = data.slice(*event[:allowed_data]) filtered_data[:event_name] = event[:id] filtered_data[:event_id] = event_id if event[:id] == "sql.active_record" binds...
[ "def", "event_subscription", "(", "event", ")", "ActiveSupport", "::", "Notifications", ".", "subscribe", "(", "event", "[", ":id", "]", ")", "do", "|", "*", ",", "event_id", ",", "data", "|", "filtered_data", "=", "data", ".", "slice", "(", "event", "["...
Subscribes to an ActiveSupport event, leaving a breadcrumb when it triggers @api private @param event [Hash] details of the event to subscribe to
[ "Subscribes", "to", "an", "ActiveSupport", "event", "leaving", "a", "breadcrumb", "when", "it", "triggers" ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/integrations/railtie.rb#L76-L92
train
bugsnag/bugsnag-ruby
lib/bugsnag/integrations/resque.rb
Bugsnag.Resque.save
def save Bugsnag.notify(exception, true) do |report| report.severity = "error" report.severity_reason = { :type => Bugsnag::Report::UNHANDLED_EXCEPTION_MIDDLEWARE, :attributes => FRAMEWORK_ATTRIBUTES } context = "#{payload['class']}@#{queue}" report.met...
ruby
def save Bugsnag.notify(exception, true) do |report| report.severity = "error" report.severity_reason = { :type => Bugsnag::Report::UNHANDLED_EXCEPTION_MIDDLEWARE, :attributes => FRAMEWORK_ATTRIBUTES } context = "#{payload['class']}@#{queue}" report.met...
[ "def", "save", "Bugsnag", ".", "notify", "(", "exception", ",", "true", ")", "do", "|", "report", "|", "report", ".", "severity", "=", "\"error\"", "report", ".", "severity_reason", "=", "{", ":type", "=>", "Bugsnag", "::", "Report", "::", "UNHANDLED_EXCEP...
Notifies Bugsnag of a raised exception.
[ "Notifies", "Bugsnag", "of", "a", "raised", "exception", "." ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/integrations/resque.rb#L39-L51
train
bugsnag/bugsnag-ruby
lib/bugsnag/middleware_stack.rb
Bugsnag.MiddlewareStack.insert_after
def insert_after(after, new_middleware) @mutex.synchronize do return if @disabled_middleware.include?(new_middleware) return if @middlewares.include?(new_middleware) if after.is_a? Array index = @middlewares.rindex {|el| after.include?(el)} else index = @middle...
ruby
def insert_after(after, new_middleware) @mutex.synchronize do return if @disabled_middleware.include?(new_middleware) return if @middlewares.include?(new_middleware) if after.is_a? Array index = @middlewares.rindex {|el| after.include?(el)} else index = @middle...
[ "def", "insert_after", "(", "after", ",", "new_middleware", ")", "@mutex", ".", "synchronize", "do", "return", "if", "@disabled_middleware", ".", "include?", "(", "new_middleware", ")", "return", "if", "@middlewares", ".", "include?", "(", "new_middleware", ")", ...
Inserts a new middleware to use after a given middleware already added. Will return early if given middleware is disabled or already added. New middleware will be inserted last if the existing middleware is not already included.
[ "Inserts", "a", "new", "middleware", "to", "use", "after", "a", "given", "middleware", "already", "added", "." ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/middleware_stack.rb#L29-L46
train
bugsnag/bugsnag-ruby
lib/bugsnag/middleware_stack.rb
Bugsnag.MiddlewareStack.insert_before
def insert_before(before, new_middleware) @mutex.synchronize do return if @disabled_middleware.include?(new_middleware) return if @middlewares.include?(new_middleware) if before.is_a? Array index = @middlewares.index {|el| before.include?(el)} else index = @mid...
ruby
def insert_before(before, new_middleware) @mutex.synchronize do return if @disabled_middleware.include?(new_middleware) return if @middlewares.include?(new_middleware) if before.is_a? Array index = @middlewares.index {|el| before.include?(el)} else index = @mid...
[ "def", "insert_before", "(", "before", ",", "new_middleware", ")", "@mutex", ".", "synchronize", "do", "return", "if", "@disabled_middleware", ".", "include?", "(", "new_middleware", ")", "return", "if", "@middlewares", ".", "include?", "(", "new_middleware", ")",...
Inserts a new middleware to use before a given middleware already added. Will return early if given middleware is disabled or already added. New middleware will be inserted last if the existing middleware is not already included.
[ "Inserts", "a", "new", "middleware", "to", "use", "before", "a", "given", "middleware", "already", "added", "." ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/middleware_stack.rb#L53-L66
train
bugsnag/bugsnag-ruby
lib/bugsnag/middleware_stack.rb
Bugsnag.MiddlewareStack.run
def run(report) # The final lambda is the termination of the middleware stack. It calls deliver on the notification lambda_has_run = false notify_lambda = lambda do |notif| lambda_has_run = true yield if block_given? end begin # We reverse them, so we can call "cal...
ruby
def run(report) # The final lambda is the termination of the middleware stack. It calls deliver on the notification lambda_has_run = false notify_lambda = lambda do |notif| lambda_has_run = true yield if block_given? end begin # We reverse them, so we can call "cal...
[ "def", "run", "(", "report", ")", "# The final lambda is the termination of the middleware stack. It calls deliver on the notification", "lambda_has_run", "=", "false", "notify_lambda", "=", "lambda", "do", "|", "notif", "|", "lambda_has_run", "=", "true", "yield", "if", "b...
Runs the middleware stack.
[ "Runs", "the", "middleware", "stack", "." ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/middleware_stack.rb#L84-L107
train
bugsnag/bugsnag-ruby
lib/bugsnag/integrations/mongo.rb
Bugsnag.MongoBreadcrumbSubscriber.leave_mongo_breadcrumb
def leave_mongo_breadcrumb(event_name, event) message = MONGO_MESSAGE_PREFIX + event_name meta_data = { :event_name => MONGO_EVENT_PREFIX + event_name, :command_name => event.command_name, :database_name => event.database_name, :operation_id => event.operation_id, :re...
ruby
def leave_mongo_breadcrumb(event_name, event) message = MONGO_MESSAGE_PREFIX + event_name meta_data = { :event_name => MONGO_EVENT_PREFIX + event_name, :command_name => event.command_name, :database_name => event.database_name, :operation_id => event.operation_id, :re...
[ "def", "leave_mongo_breadcrumb", "(", "event_name", ",", "event", ")", "message", "=", "MONGO_MESSAGE_PREFIX", "+", "event_name", "meta_data", "=", "{", ":event_name", "=>", "MONGO_EVENT_PREFIX", "+", "event_name", ",", ":command_name", "=>", "event", ".", "command_...
Generates breadcrumb data from an event @param event_name [String] the type of event @param event [Mongo::Event::Base] the mongo_ruby_driver generated event
[ "Generates", "breadcrumb", "data", "from", "an", "event" ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/integrations/mongo.rb#L46-L67
train
bugsnag/bugsnag-ruby
lib/bugsnag/integrations/mongo.rb
Bugsnag.MongoBreadcrumbSubscriber.sanitize_filter_hash
def sanitize_filter_hash(filter_hash, depth = 0) filter_hash.each_with_object({}) do |(key, value), output| output[key] = sanitize_filter_value(value, depth) end end
ruby
def sanitize_filter_hash(filter_hash, depth = 0) filter_hash.each_with_object({}) do |(key, value), output| output[key] = sanitize_filter_value(value, depth) end end
[ "def", "sanitize_filter_hash", "(", "filter_hash", ",", "depth", "=", "0", ")", "filter_hash", ".", "each_with_object", "(", "{", "}", ")", "do", "|", "(", "key", ",", "value", ")", ",", "output", "|", "output", "[", "key", "]", "=", "sanitize_filter_val...
Removes values from filter hashes, replacing them with '?' @param filter_hash [Hash] the filter hash for the mongo transaction @param depth [Integer] the current filter depth @return [Hash] the filtered hash
[ "Removes", "values", "from", "filter", "hashes", "replacing", "them", "with", "?" ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/integrations/mongo.rb#L76-L80
train
bugsnag/bugsnag-ruby
lib/bugsnag/integrations/mongo.rb
Bugsnag.MongoBreadcrumbSubscriber.sanitize_filter_value
def sanitize_filter_value(value, depth) depth += 1 if depth >= MAX_FILTER_DEPTH '[MAX_FILTER_DEPTH_REACHED]' elsif value.is_a?(Array) value.map { |array_value| sanitize_filter_value(array_value, depth) } elsif value.is_a?(Hash) sanitize_filter_hash(value, depth) els...
ruby
def sanitize_filter_value(value, depth) depth += 1 if depth >= MAX_FILTER_DEPTH '[MAX_FILTER_DEPTH_REACHED]' elsif value.is_a?(Array) value.map { |array_value| sanitize_filter_value(array_value, depth) } elsif value.is_a?(Hash) sanitize_filter_hash(value, depth) els...
[ "def", "sanitize_filter_value", "(", "value", ",", "depth", ")", "depth", "+=", "1", "if", "depth", ">=", "MAX_FILTER_DEPTH", "'[MAX_FILTER_DEPTH_REACHED]'", "elsif", "value", ".", "is_a?", "(", "Array", ")", "value", ".", "map", "{", "|", "array_value", "|", ...
Transforms a value element into a useful, redacted, version @param value [Object] the filter value @param depth [Integer] the current filter depth @return [Array, Hash, String] the sanitized value
[ "Transforms", "a", "value", "element", "into", "a", "useful", "redacted", "version" ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/integrations/mongo.rb#L89-L100
train
bugsnag/bugsnag-ruby
lib/bugsnag/configuration.rb
Bugsnag.Configuration.parse_proxy
def parse_proxy(uri) proxy = URI.parse(uri) self.proxy_host = proxy.host self.proxy_port = proxy.port self.proxy_user = proxy.user self.proxy_password = proxy.password end
ruby
def parse_proxy(uri) proxy = URI.parse(uri) self.proxy_host = proxy.host self.proxy_port = proxy.port self.proxy_user = proxy.user self.proxy_password = proxy.password end
[ "def", "parse_proxy", "(", "uri", ")", "proxy", "=", "URI", ".", "parse", "(", "uri", ")", "self", ".", "proxy_host", "=", "proxy", ".", "host", "self", ".", "proxy_port", "=", "proxy", ".", "port", "self", ".", "proxy_user", "=", "proxy", ".", "user...
Parses and sets proxy from a uri
[ "Parses", "and", "sets", "proxy", "from", "a", "uri" ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/configuration.rb#L227-L233
train
bugsnag/bugsnag-ruby
lib/bugsnag/integrations/mailman.rb
Bugsnag.Mailman.call
def call(mail) begin Bugsnag.configuration.set_request_data :mailman_msg, mail.to_s yield rescue Exception => ex Bugsnag.notify(ex, true) do |report| report.severity = "error" report.severity_reason = { :type => Bugsnag::Report::UNHANDLED_EXCEPTION_MID...
ruby
def call(mail) begin Bugsnag.configuration.set_request_data :mailman_msg, mail.to_s yield rescue Exception => ex Bugsnag.notify(ex, true) do |report| report.severity = "error" report.severity_reason = { :type => Bugsnag::Report::UNHANDLED_EXCEPTION_MID...
[ "def", "call", "(", "mail", ")", "begin", "Bugsnag", ".", "configuration", ".", "set_request_data", ":mailman_msg", ",", "mail", ".", "to_s", "yield", "rescue", "Exception", "=>", "ex", "Bugsnag", ".", "notify", "(", "ex", ",", "true", ")", "do", "|", "r...
Calls the mailman middleware.
[ "Calls", "the", "mailman", "middleware", "." ]
eaef01ab04392f362e14848edb5f29d7a3df2ae0
https://github.com/bugsnag/bugsnag-ruby/blob/eaef01ab04392f362e14848edb5f29d7a3df2ae0/lib/bugsnag/integrations/mailman.rb#L19-L35
train
codeplant/simple-navigation
lib/simple_navigation/helpers.rb
SimpleNavigation.Helpers.render_navigation
def render_navigation(options = {}, &block) container = active_navigation_item_container(options, &block) container && container.render(options) end
ruby
def render_navigation(options = {}, &block) container = active_navigation_item_container(options, &block) container && container.render(options) end
[ "def", "render_navigation", "(", "options", "=", "{", "}", ",", "&", "block", ")", "container", "=", "active_navigation_item_container", "(", "options", ",", "block", ")", "container", "&&", "container", ".", "render", "(", "options", ")", "end" ]
Renders the navigation according to the specified options-hash. The following options are supported: * <tt>:level</tt> - defaults to :all which renders the the sub_navigation for an active primary_navigation inside that active primary_navigation item. Specify a specific level to only render that level of na...
[ "Renders", "the", "navigation", "according", "to", "the", "specified", "options", "-", "hash", "." ]
ed5b99744754b8f3dfca44c885df5aa938730b64
https://github.com/codeplant/simple-navigation/blob/ed5b99744754b8f3dfca44c885df5aa938730b64/lib/simple_navigation/helpers.rb#L86-L89
train
codeplant/simple-navigation
lib/simple_navigation/helpers.rb
SimpleNavigation.Helpers.active_navigation_item
def active_navigation_item(options = {}, value_for_nil = nil) if options[:level].nil? || options[:level] == :all options[:level] = :leaves end container = active_navigation_item_container(options) if container && (item = container.selected_item) block_given? ? yield(item) : item ...
ruby
def active_navigation_item(options = {}, value_for_nil = nil) if options[:level].nil? || options[:level] == :all options[:level] = :leaves end container = active_navigation_item_container(options) if container && (item = container.selected_item) block_given? ? yield(item) : item ...
[ "def", "active_navigation_item", "(", "options", "=", "{", "}", ",", "value_for_nil", "=", "nil", ")", "if", "options", "[", ":level", "]", ".", "nil?", "||", "options", "[", ":level", "]", "==", ":all", "options", "[", ":level", "]", "=", ":leaves", "...
Returns the currently active navigation item belonging to the specified level. The following options are supported: * <tt>:level</tt> - defaults to :all which returns the most specific/deepest selected item (the leaf). Specify a specific level to only look for the selected item in the specified level of na...
[ "Returns", "the", "currently", "active", "navigation", "item", "belonging", "to", "the", "specified", "level", "." ]
ed5b99744754b8f3dfca44c885df5aa938730b64
https://github.com/codeplant/simple-navigation/blob/ed5b99744754b8f3dfca44c885df5aa938730b64/lib/simple_navigation/helpers.rb#L140-L150
train
codeplant/simple-navigation
lib/simple_navigation/helpers.rb
SimpleNavigation.Helpers.active_navigation_item_container
def active_navigation_item_container(options = {}, &block) options = SimpleNavigation::Helpers.apply_defaults(options) SimpleNavigation::Helpers.load_config(options, self, &block) SimpleNavigation.active_item_container_for(options[:level]) end
ruby
def active_navigation_item_container(options = {}, &block) options = SimpleNavigation::Helpers.apply_defaults(options) SimpleNavigation::Helpers.load_config(options, self, &block) SimpleNavigation.active_item_container_for(options[:level]) end
[ "def", "active_navigation_item_container", "(", "options", "=", "{", "}", ",", "&", "block", ")", "options", "=", "SimpleNavigation", "::", "Helpers", ".", "apply_defaults", "(", "options", ")", "SimpleNavigation", "::", "Helpers", ".", "load_config", "(", "opti...
Returns the currently active item container belonging to the specified level. The following options are supported: * <tt>:level</tt> - defaults to :all which returns the least specific/shallowest selected item. Specify a specific level to only look for the selected item in the specified level of navigation...
[ "Returns", "the", "currently", "active", "item", "container", "belonging", "to", "the", "specified", "level", "." ]
ed5b99744754b8f3dfca44c885df5aa938730b64
https://github.com/codeplant/simple-navigation/blob/ed5b99744754b8f3dfca44c885df5aa938730b64/lib/simple_navigation/helpers.rb#L175-L179
train
codeplant/simple-navigation
lib/simple_navigation/item.rb
SimpleNavigation.Item.html_options
def html_options html_opts = options.fetch(:html) { Hash.new } html_opts[:id] ||= autogenerated_item_id classes = [html_opts[:class], selected_class, active_leaf_class] classes = classes.flatten.compact.join(' ') html_opts[:class] = classes if classes && !classes.empty? html_opts ...
ruby
def html_options html_opts = options.fetch(:html) { Hash.new } html_opts[:id] ||= autogenerated_item_id classes = [html_opts[:class], selected_class, active_leaf_class] classes = classes.flatten.compact.join(' ') html_opts[:class] = classes if classes && !classes.empty? html_opts ...
[ "def", "html_options", "html_opts", "=", "options", ".", "fetch", "(", ":html", ")", "{", "Hash", ".", "new", "}", "html_opts", "[", ":id", "]", "||=", "autogenerated_item_id", "classes", "=", "[", "html_opts", "[", ":class", "]", ",", "selected_class", ",...
Returns the html-options hash for the item, i.e. the options specified for this item in the config-file. It also adds the 'selected' class to the list of classes if necessary.
[ "Returns", "the", "html", "-", "options", "hash", "for", "the", "item", "i", ".", "e", ".", "the", "options", "specified", "for", "this", "item", "in", "the", "config", "-", "file", ".", "It", "also", "adds", "the", "selected", "class", "to", "the", ...
ed5b99744754b8f3dfca44c885df5aa938730b64
https://github.com/codeplant/simple-navigation/blob/ed5b99744754b8f3dfca44c885df5aa938730b64/lib/simple_navigation/item.rb#L51-L60
train
codeplant/simple-navigation
lib/simple_navigation/item_container.rb
SimpleNavigation.ItemContainer.item
def item(key, name, url = nil, options = {}, &block) return unless should_add_item?(options) item = Item.new(self, key, name, url, options, &block) add_item item, options end
ruby
def item(key, name, url = nil, options = {}, &block) return unless should_add_item?(options) item = Item.new(self, key, name, url, options, &block) add_item item, options end
[ "def", "item", "(", "key", ",", "name", ",", "url", "=", "nil", ",", "options", "=", "{", "}", ",", "&", "block", ")", "return", "unless", "should_add_item?", "(", "options", ")", "item", "=", "Item", ".", "new", "(", "self", ",", "key", ",", "na...
Creates a new navigation item. The <tt>key</tt> is a symbol which uniquely defines your navigation item in the scope of the primary_navigation or the sub_navigation. The <tt>name</tt> will be displayed in the rendered navigation. This can also be a call to your I18n-framework. The <tt>url</tt> is the address th...
[ "Creates", "a", "new", "navigation", "item", "." ]
ed5b99744754b8f3dfca44c885df5aa938730b64
https://github.com/codeplant/simple-navigation/blob/ed5b99744754b8f3dfca44c885df5aa938730b64/lib/simple_navigation/item_container.rb#L64-L68
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train