conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use the rspec concept of a subject." }, { "from": "human", "value": "require File::expand_path('../../spec_helper', __FILE__)\nrequire 'raven'\n\ndescribe Raven::Client do\n\n shared_examples 'a configured client' do\n it 'should have a server' do\n @client...
ruby
chosen
[ { "from": "system", "value": "Enable creating config files when initializing project\n" }, { "from": "human", "value": "module Expando\n class ProjectTemplate\n class << self\n # Initialize a new Expando project in the current working directory.\n def init!\n mkdir 'intents'...
ruby
chosen
[ { "from": "system", "value": "Move back to original dir before removing CWD\n" }, { "from": "human", "value": "\nGiven /^I have wiped the folder \"(.*?)\"$/ do |path|\n FileUtils.rm_rf(path)\nend\n\n\nOriginalWorkingDirectory = Dir.pwd\nBefore do\n FileUtils.chdir(OriginalWorkingDirectory)\nen...
ruby
chosen
[ { "from": "system", "value": "Improve variable naming in RubyClosure.\n" }, { "from": "human", "value": "require 'ffi-gobject/closure'\n\nmodule GObject\n # This class encapsulates Ruby\n # blocks as GObject Closures.\n class RubyClosure < Closure\n BLOCK_STORE = {}\n\n # Extend the sta...
ruby
chosen
[ { "from": "system", "value": "Use compat mode for hashes with symbol keys\n" }, { "from": "human", "value": "module Lanes\n module API\n\n module HelperMethods\n\n def bootstrap_data\n Oj.dump Extension.bootstrap_data(self)\n end\n\n def ...
ruby
chosen
[ { "from": "system", "value": "Make affected_items an arrary instead of hash\n" }, { "from": "human", "value": "module Origen\n module Errata\n class HwErratum \n\n # ID number used to identify erratum \n attr_reader :id\n \n # Erratum Title\n attr_accessor :title\n \n ...
ruby
chosen
[ { "from": "system", "value": "Replace invalid chars when massaging encoding\n" }, { "from": "human", "value": "require 'delegate'\nrequire 'csv'\nrequire 'digest/md5'\n\nmodule Peddler\n # @api private\n class FlatFileParser < SimpleDelegator\n # http://stackoverflow.com/questions/8073920/i...
ruby
chosen
[ { "from": "system", "value": "Remove removed files from gemspec\n" }, { "from": "human", "value": "# encoding: utf-8\n\n$LOAD_PATH.unshift(File.expand_path('../lib/', __FILE__))\nrequire 'cri/version'\n\nGem::Specification.new do |s|\n s.name = 'cri'\n s.version = Cri::VERSION\n s....
ruby
chosen
[ { "from": "system", "value": "Make it easier to publish from elsewhere\n" }, { "from": "human", "value": "module Pubsubstub\n class RedisPubSub\n def initialize(channel_name)\n @channel_name = channel_name\n end\n\n def subscribe(callback)\n RedisPubSub.sub.subscribe(key('pub...
ruby
chosen
[ { "from": "system", "value": "Fix code generation of ClassMacros\n\nBefore this commit ClassMacros defined one `inherited` hook once per macro.\n\nThis commit separates the definition of accessors and other definitions.\n" }, { "from": "human", "value": "module ROM\n module ClassMacros\n Und...
ruby
chosen
[ { "from": "system", "value": "Generalize the plural for secretary of state\n" }, { "from": "human", "value": "# Be sure to restart your server when you modify this file.\n\n# Add new inflection rules using the following format. Inflections\n# are locale specific, and you may define rules for as ...
ruby
chosen
[ { "from": "system", "value": "Add additional parameters for Kubernetes\n" }, { "from": "human", "value": "require 'sensu-plugins-kubernetes/version'\n\nrequire 'sensu-plugin/check/cli'\nrequire 'kubeclient'\n\nmodule Sensu\n module Plugins\n module Kubernetes\n class CLI < S...
ruby
chosen
[ { "from": "system", "value": "Use dash in presets name\n" }, { "from": "human", "value": "module RailsUploads\n module Types\n class Image < File\n\n def has_presets?\n presets.any?\n end\n\n def presets\n (Rails.application.config.uploads.default_presets | (@opt...
ruby
chosen
[ { "from": "system", "value": "Make path to a config file relative to the current file\n" }, { "from": "human", "value": "require \"reek\"\n\nmodule Rubycritic\n module Analyser\n\n class Reek < ::Reek::Examiner\n DEFAULT_CONFIG_FILES = [\"lib/rubycritic/analysers/config.reek\"]\n\n ...
ruby
chosen
[ { "from": "system", "value": "Remove unused model_class attribute from SlugGenerator\n" }, { "from": "human", "value": "module FriendlyId\n # The default slug generator offers functionality to check slug strings for\n # uniqueness and, if necessary, appends a sequence to guarantee it.\n class...
ruby
chosen
[ { "from": "system", "value": "Fix undefined method `ask' ERROR\n" }, { "from": "human", "value": "use_codes = {\n \"A\" => \"Federal government\",\n \"B\" => \"State government\",\n \"C\" => \"Tribe/Status Indian/Indian Band\",\n \"D\" => \"Foreign diplomat\",\n \"E\" => \"Charitable or ben...
ruby
chosen
[ { "from": "system", "value": "Convert incoming commands to strings in case they are nil.\n" }, { "from": "human", "value": "require \"rash\"\nrequire \"digital_ocean\"\n\nrequire_relative \"digitalocean/ssh_keys\"\n\nmodule Lita\n module Handlers\n class Digitalocean < Handler\n class A...
ruby
chosen
[ { "from": "system", "value": "Update seed file to include recipes\n" }, { "from": "human", "value": "require 'faker'\n\n\nUser.destroy_all\nList.destroy_all\nItem.destroy_all\n\nall_lists = [\n \"Jewel Osco - Sunday\",\n \"Family Picnic\",\n \"Brunch\",\n \"Sam's Club List\",\n \"Party Time...
ruby
chosen
[ { "from": "system", "value": "Fix layout of protected embed\n" }, { "from": "human", "value": "require_dependency 'carto/api/vizjson3_presenter'\n\nmodule Carto\n module Builder\n module Public\n class EmbedsController < BuilderController\n include VisualizationsControllerHelper\...
ruby
chosen
[ { "from": "system", "value": "Refactor admin policy to use expect\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Neighborly::Admin::AdminPolicy do\n subject { described_class }\n\n permissions :access? do\n it 'should deny access if user is nil' do\n should_not pe...
ruby
chosen
[ { "from": "human", "value": "Add send urls through proxy script\n" }, { "from": "gpt", "value": "#!/usr/bin/env ruby\n\n#\n# Requests a list of URLs through a proxy.\n#\n\nrequire 'typhoeus'\n\nurls = File.open(ARGV.join).read.split(\"\\n\")\nproxy = 'http://127.0.0.1:8080'\n\n\nurls.each_with_...
ruby
chosen
[ { "from": "human", "value": "Add tests for the routing\n" }, { "from": "gpt", "value": "describe Comable::Admin::ThemesController do\n routes { Comable::Core::Engine.routes }\n\n let(:theme) { build(:theme) }\n let(:path) { 'path/to/file.liquid' }\n\n describe 'routing' do\n it 'routes to...
ruby
chosen
[ { "from": "system", "value": "Return all lines of the BODY in SkypeMessage\n" }, { "from": "human", "value": "module Basil\n class SkypeMessage\n # We can assume this always matches since the first group is\n # optional and the second group is effectively +.*+\n BODY_MASK =\n /\n ...
ruby
chosen
[ { "from": "system", "value": "Add rake tasks for running unit and functional tests\n" }, { "from": "human", "value": "require File.expand_path('../spec_suite_configuration', __FILE__)\n\nrequire 'ostruct'\n\nclass DefinesSpecSuiteTasks\n extend Rake::DSL\n\n def self.configuration\n @config...
ruby
chosen
[ { "from": "system", "value": "Remove unused factory for ReadingGroup\n" }, { "from": "human", "value": "FactoryGirl.define do\n factory :reading_group do\n name \"Mussum\"\n description \"Cacildis!\"\n\n trait :with_id do\n sequence(:id, 1)\n end\n\n factory :another_reading...
ruby
chosen
[ { "from": "system", "value": "Select time instead of select date\n" }, { "from": "human", "value": "class Forecast\n class Collection < Array\n def select_date(date)\n result = nil\n date_forecasts = self.select do |obj|\n obj.date.to_date == date.to_date\n end\n i...
ruby
chosen
[ { "from": "human", "value": "Add unit test for section\n" }, { "from": "gpt", "value": "describe Section do\n\n let(:title) { 'title' }\n let(:paras) { %w{a b c} }\n\n it 'should initialize title' do\n subject = Section.new title do\n end\n\n subject.title.should == title\n end\n\n ...
ruby
chosen
[ { "from": "system", "value": "Use fail instead of raise to throw exceptions\n" }, { "from": "human", "value": "name :bsa\nrequire_helpers :get_field_as_float\n\nexecute do\n weight = get_field_as_float :weight_in_kg\n height = get_field_as_float :height_in_m\n\n raise FieldError.new('weight',...
ruby
chosen
[ { "from": "system", "value": "Use self.target= in HasOneThroughAssociation too\n" }, { "from": "human", "value": "module ActiveRecord\n # = Active Record Has One Through Association\n module Associations\n class HasOneThroughAssociation < HasOneAssociation\n include ThroughAssociation\...
ruby
chosen
[ { "from": "system", "value": "Revert \"Revert \"Default stamp duty welsh fix to a blank lambda\"\"\n\nThis reverts commit 406b44dde3f2bec8431bd38babd783c2e6a85148.\n" }, { "from": "human", "value": "require \"mortgage_calculator/engine\"\nrequire 'mortgage_calculator/currency_input'\n\nmodule Mo...
ruby
chosen
[ { "from": "system", "value": "Fix a bug in AutoScoping.\n" }, { "from": "human", "value": "module WLang\n class Compiler\n class Autospacing < Filter\n\n def on_strconcat(*exps)\n optimized = []\n exps.each_with_index do |exp,i|\n optimized[i] = call(exp)\n ...
ruby
chosen
[ { "from": "system", "value": "Use faraday instead of docomoru\n" }, { "from": "human", "value": "Gem::Specification.new do |spec|\n spec.name = \"lita-talk\"\n spec.version = \"0.1.5\"\n spec.authors = [\"fukayatsu\"]\n spec.email = [\"fukayatsu@gmail.com\"]\n s...
ruby
chosen
[ { "from": "system", "value": "Add basic spec for docstrings\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Docstrings do\n it 'should have a version number' do\n Docstrings::VERSION.should_not be_nil\n end\n\n it 'should do something useful' do\n false.should be_tr...
ruby
chosen
[ { "from": "human", "value": "Add rake task for image crawler\n" }, { "from": "gpt", "value": "require 'pixelfinder/image_client/image_crawler'\n\nnamespace :pixelfinder do\n namespace :save_images do\n\n desc \"Save images from Flickr\"\n task :from_flickr, [:num_of_images] => [:environme...
ruby
chosen
[ { "from": "system", "value": "Add 'mingo_id' as a proper spec helper.\n" }, { "from": "human", "value": "# Helper to run a set of specs several times under different conditions.\ndef branch(*args, &block)\n args.map { |sym| ActiveSupport::StringInquirer.new sym.to_s }.each(&block)\nend\n" }, ...
ruby
chosen
[ { "from": "system", "value": "Change directory when testing default `churn` command\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe \"Churn command\" do\n it \"prints churn metrics as text by default\" do\n output = %x[ cd spec/samplerepo & churn ]\n expect(output).to...
ruby
chosen
[ { "from": "system", "value": "Stop using non-example emails in factories\n\nNoticed this when setting up ds-auth app, which\nhad copy-pasta setup." }, { "from": "human", "value": "FactoryGirl.define do\n factory :user do |user|\n sequence(:email) {|n| \"barry#{n}@factory.com\" }\n...
ruby
chosen
[ { "from": "human", "value": "Add spec for '::create_new_project' Nod::Asset class method\n" }, { "from": "gpt", "value": "\nrequire 'spec_helper'\n\nRSpec.describe Nod::Asset, fakefs: true do\n let(:asset) { Nod::Asset }\n let(:project_name) { 'test-project' }\n\n describe '::create_new_proje...
ruby
chosen
[ { "from": "human", "value": "Add first draft of the 'create request' test\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\nRSpec.describe \"Creating Defence Request\" do\n specify \"CSO creates a new Defence Request\" do\n visit SERVICE_APP_URI\n\n click_link \"New request\"\n\n ...
ruby
chosen
[ { "from": "system", "value": "Remove spike code, will be proper RSpec soon\n" }, { "from": "human", "value": "require File.dirname(__FILE__) + '/../../lib/mousetrap'\nrequire 'yaml'\nrequire 'activesupport'\n\n# Requires supporting files with custom matchers and macros, etc,\n# in ./support/ and...
ruby
chosen
[ { "from": "human", "value": "Add spec for using multiple simultaneous instances\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe Fabrication do\n\n context 'multiple instance' do\n\n let(:person1) { Fabricate(:person, :first_name => 'Jane') }\n let(:person2) { Fabricate(...
ruby
chosen
[ { "from": "system", "value": "Add ability to associate vms with ip addresses\n" }, { "from": "human", "value": "module OneOne\n class FirewallPolicyResource < BaseResource\n resources do\n default_handler do |response|\n fail \"Unexpected response status #{response.status}... #{r...
ruby
chosen
[ { "from": "system", "value": "Change MoneyQuestionPresenter.to_response() to not return hash. Fixes display issue.\n" }, { "from": "human", "value": "module SmartdownAdapter\n class MoneyQuestionPresenter < SmartdownAdapter::QuestionPresenter\n def to_response(input)\n { amount: input }...
ruby
chosen
[ { "from": "system", "value": "Support custom categories upload in a given locale\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nnamespace :gobierto_budgets do\n namespace :custom_categories do\n desc \"Import categories\"\n task :import, [:site_domain, :file_path] => ...
ruby
chosen
[ { "from": "human", "value": "Add specific tests for the resque latency extension\n\nWe stub the lower layer Redis to avoid needing to have it running for\nthe tests, but it should help ensure the behavior of Resque that we\nexpect to extend is working correctly for storing the timestamp and\ncalculating lat...
ruby
chosen
[ { "from": "system", "value": "Use report instead of alert, as suggested by @ejaubaud\n" }, { "from": "human", "value": "require 'resolv'\n\nclass NameResolver < Scout::Plugin\n OPTIONS=<<-EOS\n nameserver:\n default: 8.8.8.8\n resolve_address:\n default: google.com\n EOS\n\n d...
ruby
chosen
[ { "from": "system", "value": "Use assert_equality to DRY up tests\n" }, { "from": "human", "value": "require_relative 'fizzbuzz_function'\n\ndef assert(condition, failure_message)\n unless condition\n raise failure_message\n end\nend\n\ndef assert_equality(expected, actual)\n failure_messa...
ruby
chosen
[ { "from": "system", "value": "Fix rendering of authors string\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'griddler/cloudmailin/version'\n\nGem::Specification.new do |spec|\n spe...
ruby
chosen
[ { "from": "system", "value": "Allow Thor > 0.14 until 1.X since Thor uses schemantic versioning.\n\nSee https://github.com/rails/rails/commit/7dc83f78232a6dfcdd70292e831403933f57347b\nfor more info.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nlib = File.expand_path('../lib', __...
ruby
chosen
[ { "from": "system", "value": "Use redirect instead of render\n" }, { "from": "human", "value": "class MatricesController < ApplicationController\n\n ### Resources methods ########################################################\n\n def index\n @filterrific = initialize_filterrific(\n M...
ruby
chosen
[ { "from": "system", "value": "Refactor routes with rails helper url methods\n\nUse root_path in #create and #destroy actions in sessions controller\n" }, { "from": "human", "value": "class SessionsController < ApplicationController\n\n def new\n end\n\n def create\n user = User.find_by(nam...
ruby
chosen
[ { "from": "system", "value": "Use a layout for mailing\n" }, { "from": "human", "value": "class IslayShop::OrderMailer < ActionMailer::Base\n helper '/islay/public/application'\n\n default :from => Settings.for(:shop, :email),\n :charset => 'UTF-8'\n\n def thank_you(order)\n @orde...
ruby
chosen
[ { "from": "system", "value": "Fix responce status for failed auth.\n" }, { "from": "human", "value": "require 'rails-api'\nmodule ApiFlashcards\n class ApiController < ActionController::API\n include ActionController::HttpAuthentication::Basic::ControllerMethods\n before_action :authentic...
ruby
chosen
[ { "from": "system", "value": "Add some attributes to district serializer\n" }, { "from": "human", "value": "class DistrictSerializer < ActiveModel::Serializer\n attributes :name, :vpc_id, :public_elb_security_group, :private_elb_security_group,\n :instance_security_group, :ecs_servi...
ruby
chosen
[ { "from": "system", "value": "Add a formatter for message, to make it pretty\n" }, { "from": "human", "value": "require 'sinatra'\nrequire 'json'\nrequire 'sinatra/json'\nrequire 'sinatra/reloader' if development?\nrequire 'rest-client'\nrequire_relative 'env.rb'\n\nset :server, \"thin\"\nset :r...
ruby
chosen
[ { "from": "system", "value": "Fix interrupts to display keypress on newline.\n" }, { "from": "human", "value": "require \"vapebot/command\"\nrequire \"vapebot/handler\"\nrequire \"vapebot/logger\"\n\nclass Bot\n include Command\n include Handler\n attr_reader :connection\n def initialize\n ...
ruby
chosen
[ { "from": "human", "value": "Add basic SearchOrders service spec\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe SearchOrders do\n let!(:distributor) { create(:distributor_enterprise) }\n let!(:order1) { create(:order, distributor: distributor) }\n let!(:order2) { create(:o...
ruby
chosen
[ { "from": "system", "value": "Change serverspec to check for application title - rubygems\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe 'Sheldon 6artisans webserver' do\n\n it 'has nginx installed' do\n expect(package 'nginx').to be_installed\n end\n\n it 'is running...
ruby
chosen
[ { "from": "system", "value": "Add additional validations for User model\n\n - Allow Owner to update user information from console without need of password.\n" }, { "from": "human", "value": "class User < ActiveRecord::Base\n\n # Include default devise modules. Others available are:\n # :lockab...
ruby
chosen
[ { "from": "system", "value": "Fix precompile test for Rails 3.2\n" }, { "from": "human", "value": "require 'test_helper'\nrequire 'fileutils'\n\nclass ReactTest < ActionDispatch::IntegrationTest\n test 'asset pipeline should deliver drop-in react file replacement' do\n app_react_file_path = ...
ruby
chosen
[ { "from": "system", "value": "Undo 101a650a7 as this is intercepting rails helpers\n" }, { "from": "human", "value": "module ExpressTemplates\n module Components\n module Capabilities\n module Building\n def method_missing(name, *args)\n raise \"#{self.class.to_s} has no...
ruby
chosen
[ { "from": "system", "value": "Fix spree_conekta generator to use the real extension assets\n" }, { "from": "human", "value": "module SpreeConekta\n module Generators\n class InstallGenerator < Rails::Generators::Base\n\n class_option :auto_run_migrations, type: :boolean, default: false\...
ruby
chosen
[ { "from": "system", "value": "Add more specs for activity session exporter\n" }, { "from": "human", "value": "require 'rails_helper'\n\ndescribe CsvExporter::ActivitySession do\n include_context 'Activity Progress Report'\n let(:csv_exporter) { CsvExporter::ActivitySession.new }\n\n describe ...
ruby
chosen
[ { "from": "system", "value": "Fix minor code style issue.\n" }, { "from": "human", "value": "module Neo4j::ActiveNode\n describe NodeListFormatter do\n let(:max_elements) { 5 }\n\n subject { described_class.new(list, max_elements) }\n\n context 'when the list length is greater than `ma...
ruby
chosen
[ { "from": "system", "value": "Use a SPDX compliant license string\n\nSigned-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)...
ruby
chosen
[ { "from": "system", "value": "Include version in `GET /` metadata\n" }, { "from": "human", "value": "# frozen_string_literal: true\n# vim:fileencoding=utf-8\n\nrequire_relative 'images_api'\nrequire_relative 'job_delivery_api'\n\nrequire 'rack/deflater'\nrequire 'sinatra/base'\n\nmodule JobBoard...
ruby
chosen
[ { "from": "human", "value": "Migrate HMRC manuals from 'live' to 'beta'\n\nHMRC manuals are rendered with a 'beta' banner due to custom logic in\nManuals Frontend, as we're migrating to Government Frontend we need to\nset the phase value to persist the beta status.\n\nThere are questions around whether thes...
ruby
chosen
[ { "from": "system", "value": "Add line terminator at end of file\n" }, { "from": "human", "value": "require 'digest'\nrequire 'base64'\nrequire 'uri'\n\nrequire 'notifications/client'\n\nmodule DMNotify\n def self.get_email(message_type, email_address)\n email_hash = Base64.urlsafe_encode64(...
ruby
chosen
[ { "from": "system", "value": "Fix tests broken by ipv4 resolve mode\n" }, { "from": "human", "value": "require 'parsley'\n\ndescribe Parsley::CurbDownloader do\n it 'passes user agent to curl request' do\n headers = double(:headers)\n headers.should_receive(:[]=).with('User-Agent', :somet...
ruby
chosen
[ { "from": "system", "value": "Add comments to better document RSpec includes and extends\n" }, { "from": "human", "value": "require_relative \"./junklet/version\"\nrequire_relative \"./junklet/junk\"\nrequire_relative \"./junklet/junklet\"\n\nRSpec.configure do |config|\n config.extend(RSpec::J...
ruby
chosen
[ { "from": "system", "value": "Set SC alias to Skr.Components\n" }, { "from": "human", "value": "require 'lanes/access/extension'\n\nmodule Skr\n\n class Extension < Lanes::Extensions::Definition\n\n identifier \"skr\"\n title \"Stockor\"\n root_path Pathname.new(__FILE__)...
ruby
chosen
[ { "from": "system", "value": "Make @lists available to index.html.erb\n" }, { "from": "human", "value": "class ListController < ApplicationController\n def index\n end\n\n def new\n end\n\n def create\n end\n\n def edit\n end\n\n def show\n end\n\n def update\n end\n\n def destroy\n...
ruby
chosen
[ { "from": "system", "value": "Add debug flag for debugging https\n" }, { "from": "human", "value": "class MainController < ApplicationController\n def home\n end\n\n def dependencies\n gem_names = params[:gems].to_s\n .split(\",\")\n .select {|e| e.start_with?(GEM_PREFIX) }\n ...
ruby
chosen
[ { "from": "system", "value": "Update behavior importer to handle dates/times that are already parsed by CsvTransformer\n" }, { "from": "human", "value": "class BehaviorImporter\n include Connector\n include Importer\n\n def remote_file_name\n 'behavior_export.txt'\n end\n\n def import_ro...
ruby
chosen
[ { "from": "system", "value": "Add about page in Sinatra actions\n" }, { "from": "human", "value": "require 'sinatra'\nrequire 'erb'\n\nset :root, File.dirname(__FILE__)\n\nclass RubyCasts\n get '/' do\n erb :index\n end\nend" }, { "from": "gpt", "value": "require 'sinatra'\nrequ...
ruby
chosen
[ { "from": "system", "value": "Remove old default response test\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nRSpec.describe Pragma::Operation::Base do\n subject(:result) do\n operation_klass.call(\n { foo: 'bar' },\n { 'current_user_id' => 1 }\n )\n end\n\...
ruby
chosen
[ { "from": "system", "value": "Enable access to Name and Address from Gimei object\n" }, { "from": "human", "value": "require 'gimei/version'\nrequire 'gimei/name'\nrequire 'gimei/address'\nrequire 'yaml'\nrequire 'forwardable'\n\nclass Gimei\n extend Forwardable\n\n NAMES = YAML.load_file(File...
ruby
chosen
[ { "from": "system", "value": "Refactor launch! method to separate part of code to get_action method\n" }, { "from": "human", "value": "require 'restaurant'\n\nclass Guide\n\n def initialize(path = nil)\n # locate the restaurant text file at path\n Restaurant.filepath = path\n if Restau...
ruby
chosen
[ { "from": "human", "value": "Add column in apn app table to identify an application\n" }, { "from": "gpt", "value": "class AddNameToApnApp < ActiveRecord::Migration\n def change\n \tadd_column\t:apn_apps, :name, :string, :unique => true\n \tadd_index\t:apn_apps, :name, :unique => true\n end\...
ruby
chosen
[ { "from": "system", "value": "Fix -v/--version option in Ruby 1.8.7\n" }, { "from": "human", "value": "# encoding: utf-8\nmodule Apiary\n module Command\n # Run commands\n class Runner\n\n def self.run(cmd, options)\n Apiary::Command.const_get(cmd.capitalize).send(:execute, op...
ruby
chosen
[ { "from": "system", "value": "Set default value for errors so that it is never nil\n" }, { "from": "human", "value": "require \"openlogi/errors\"\n\nmodule Openlogi\n class BaseObject < Hashie::Dash\n include Hashie::Extensions::Dash::Coercion\n include Hashie::Extensions::MergeInitialize...
ruby
chosen
[ { "from": "system", "value": "Add a method to mint a new DOI.\n" }, { "from": "human", "value": "require \"minty/version\"\n\nrequire \"rest_client\"\n\nmodule Minty\n\n class DataCite\n\n def initialize(endpoint = 'http://test.datacite.com')\n @endpoint = endpoint\n end\n\n def r...
ruby
chosen
[ { "from": "system", "value": "Check if config file is empty before attempting to read it." }, { "from": "human", "value": "# encoding: utf-8\n\nmodule Backup\n module Storage\n class Object\n\n ##\n # Holds the type attribute\n attr_accessor :storage_file\n\n ##\n # ...
ruby
chosen
[ { "from": "system", "value": "Create patch /items/:id to have ability to update item information\n" }, { "from": "human", "value": "Rails.application.routes.draw do\n get '/items', to: 'items#index'\n get '/items/new', to: 'items#new', as: 'new_item'\n post '/items', to: 'items#create'\n get...
ruby
chosen
[ { "from": "system", "value": "Remove unused imprint route (imprint is on the contact page).\n" }, { "from": "human", "value": "Teikei::Application.routes.draw do\n\n # Define routes for regular users\n devise_for :users, controllers: { confirmations: 'confirmations' }\n\n namespace :api, defa...
ruby
chosen
[ { "from": "system", "value": "Address PR comments and use more guard-clause-like structure.\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire 'faraday'\nrequire 'faraday_middleware'\nrequire 'faraday/detailed_logger'\nrequire 'cloudflair/error/cloudflair_error'\n\nmodul...
ruby
chosen
[ { "from": "system", "value": "Fix login bug that was introduced when we added the public front end\n" }, { "from": "human", "value": "require 'guides_front_end'\n\nGuides::Application.routes.draw do\n authenticate :user do\n match '/preview/:edition_id' => GuidesFrontEnd::Preview, :anchor =>...
ruby
chosen
[ { "from": "system", "value": "Add new 32 and 64-bit SCS dylibs to SCS formula\n" }, { "from": "human", "value": "require \"formula\"\n\nclass Scs < Formula\n homepage \"https://github.com/cvxgrp/scs\"\n url \"https://github.com/cvxgrp/scs/archive/v1.0.7.tar.gz\"\n head \"https://github.com/cv...
ruby
chosen
[ { "from": "system", "value": "Add file to load path\n" }, { "from": "human", "value": "require 'pry'\n\nclass CompPlayer\n\n def minimax(board, rules, increment = 10)\n return 1000 if rules.won?(board, \"X\")\n return -1000 if rules.won?(board, \"O\")\n return 0 if rules.draw?(board, b...
ruby
chosen
[ { "from": "system", "value": "Fix Order reference in OrderDecorator\n" }, { "from": "human", "value": "Order.class_eval do\n token_resource\n\n # Associates the specified user with the order and destroys any previous association with guest user if\n # necessary.\n def associate_user!(user)\n...
ruby
chosen
[ { "from": "system", "value": "Use composite index for queries by sluggable\n\nA sluggable_id index alone isn't much use since the id only makes since in the context of a sluggable_type. This allows for much faster look ups (and better query planning) when searching by a sluggable." }, { "from": "hum...
ruby
chosen
[ { "from": "system", "value": "Fix getting JSON data from Instagram again\n" }, { "from": "human", "value": "require 'net/http'\nrequire 'uri'\n\nclass InstagramIntegration\n def media\n edges_array = response_object.graphql.user.edge_owner_to_timeline_media.edges\n edges_array.map do |edg...
ruby
chosen
[ { "from": "system", "value": "Set sinatra root to correct value\n" }, { "from": "human", "value": "require 'sinatra/base'\nrequire 'sass'\nrequire 'haml'\nrequire 'coffee'\n\nclass Lysergide::Application < Sinatra::Base\n\tset :server, :webrick\n\tset :views, settings.root + '/../../views'\n\tse...
ruby
chosen
[ { "from": "system", "value": "Remove double bang from a guaranteed boolean\n" }, { "from": "human", "value": "require 'microspec/predicates'\n\nmodule Microspec\n module Expectation\n module Methods\n def asserts(object)\n Object.new true, object\n end\n\n def refutes(o...
ruby
chosen
[ { "from": "system", "value": "Add retry middleware to Faraday connection\n\nCloses #33\n\nBy default, it retries 2 times and handles only timeout exceptions\n\nhttps://github.com/lostisland/faraday/blob/master/lib/faraday/request/retry.rb" }, { "from": "human", "value": "require 'faraday'\nrequi...
ruby
chosen
[ { "from": "system", "value": "Make specs pass with publify_core 9.0.0.pre5\n" }, { "from": "human", "value": "require 'rails_helper'\n\nRSpec.describe AmazonSidebar do\n describe 'without constructor parameters' do\n let(:sidebar) { AmazonSidebar.new }\n\n it \"title should be 'Cited book...
ruby
chosen
[ { "from": "system", "value": "Support for displaying negative numbers when formatting currency\n" }, { "from": "human", "value": "# IntegerExt\n#\n# AUTHOR:: Kyle Mullins\n\nmodule IntegerExt\n def format_currency\n '$' + to_s.reverse.scan(/(\\d*\\.\\d{1,3}|\\d{1,3})/).join(',').reverse\n ...
ruby
chosen
[ { "from": "human", "value": "Add feature specs for edit project settings\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe 'Edit Project Settings', feature: true do\n let(:user) { create(:user) }\n let(:project) { create(:empty_project, path: 'gitlab', name: 'sample') }\n\n b...
ruby
chosen
[ { "from": "system", "value": "Add specs for account credential creation.\n" }, { "from": "human", "value": "require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')\n\ndescribe \"account:setup command\" do\n \n before(:all) { setup_temp_home_directory }\n \n context \"witho...
ruby
chosen
[ { "from": "system", "value": "Use local variable(file) instead of instance variable(@file)\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nrequire 'zip/zip'\n\nmodule Goblin\n class Book\n attr_reader :sheets\n\n def initialize(file, &block)\n @file = file\n @files =...
ruby
chosen