repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/shellcheck.rb | lib/quality/tools/shellcheck.rb | # frozen_string_literal: true
module Quality
module Tools
# Adds 'ShellCheck' tool support to quality gem
class Shellcheck < Tool
def shellcheck_args
"-fgcc -sbash #{shell_files.join(' ')}"
end
def quality_shellcheck
ratchet_quality_cmd('shellcheck',
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/scalastyle.rb | lib/quality/tools/scalastyle.rb | # frozen_string_literal: true
module Quality
module Tools
# Adds 'scalastyle' tool support to quality gem
class Scalastyle < Tool
def scalastyle_args
c = " -c '#{scalastyle_config}' " if scalastyle_config
x = " -x '#{scalastyle_exclude}' " if scalastyle_exclude
args = ''
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/rake/task.rb | lib/quality/rake/task.rb | # frozen_string_literal: true
# XXX: There's an underlying issue with bundler, and knowing my luck,
# probably RVM that is causing confusion on which version of rake is
# being pulled in in this situation. Similar issues from the past:
#
# http://stackoverflow.com/questions/6085610/
# ruby-on-rails-and-rake-probl... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/x-editable-rails_test.rb | test/x-editable-rails_test.rb | require 'test_helper'
class XEditableRailsTest < ActiveSupport::TestCase
test "truth" do
assert_kind_of Module, X::Editable::Rails
end
end
| ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/test_helper.rb | test/test_helper.rb | # Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require "rails/test_help"
Rails.backtrace_cleaner.remove_silencers!
# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
# Load fixtures from the engi... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/view_helpers_test.rb | test/view_helpers_test.rb | require 'test_helper'
class ViewHelpersTest < ActionView::TestCase
include X::Editable::Rails::ViewHelpers
class Subject < OpenStruct
include ActiveModel::Model
attr_accessor :id, :name, :content, :active
def self.model_name
ActiveModel::Name.new(self, nil, "Page")
end
def initialize(... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/app/helpers/application_helper.rb | test/dummy/app/helpers/application_helper.rb | module ApplicationHelper
end
| ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/app/controllers/welcome_controller.rb | test/dummy/app/controllers/welcome_controller.rb | class WelcomeController < ApplicationController
def index
@pages = Page.all
end
end
| ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/app/controllers/pages_controller.rb | test/dummy/app/controllers/pages_controller.rb | class PagesController < ApplicationController
respond_to :html, :json
before_action :set_page, only: [:show, :edit, :update, :destroy]
# GET /pages
def index
@pages = Page.all
respond_with @pages
end
# GET /pages/1
def show
respond_with @page
end
# GET /pages/new
def new
@page = P... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/app/controllers/application_controller.rb | test/dummy/app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
# protect_from_forgery with: :exception
def xeditable? object = nil
xeditable = params[:denied] ? false : true
can?(:edit, object) and xeditable ? ... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/app/models/page.rb | test/dummy/app/models/page.rb | class Page < ActiveRecord::Base
translates :title
accepts_nested_attributes_for :translations, allow_destroy: true
validates :name, length: { minimum: 5 }, allow_blank: true
end
| ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/db/seeds.rb | test/dummy/db/seeds.rb | Page.create!(
active: true, name: 'Apple iPhone', description: '<b>Apple</b></br>iPhone is a ...',
translations_attributes: [{ title: 'Apple CS', locale: 'cs' }, { title: 'Apple EN', locale: 'en' } ]) | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/db/schema.rb | test/dummy/db/schema.rb | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/db/migrate/20131115152536_create_pages.rb | test/dummy/db/migrate/20131115152536_create_pages.rb | class CreatePages < ActiveRecord::Migration
def change
create_table :pages do |t|
t.boolean :active
t.string :name
t.text :description
t.timestamps
end
create_table :page_translations do |t|
t.references :page, index: true
t.string :locale, null: false
t.string... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/config/application.rb | test/dummy/config/application.rb | require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)
require "x-editable-rails"
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in ... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/config/environment.rb | test/dummy/config/environment.rb | # Load the Rails application.
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
Dummy::Application.initialize!
| ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/config/routes.rb | test/dummy/config/routes.rb | Dummy::Application.routes.draw do
root "welcome#index"
resources :pages
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of r... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/config/boot.rb | test/dummy/config/boot.rb | # Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
| ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/config/initializers/filter_parameter_logging.rb | test/dummy/config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
| ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/config/initializers/session_store.rb | test/dummy/config/initializers/session_store.rb | # Be sure to restart your server when you modify this file.
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
| ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/config/initializers/wrap_parameters.rb | test/dummy/config/initializers/wrap_parameters.rb | # Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters f... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/config/initializers/inflections.rb | test/dummy/config/initializers/inflections.rb | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflec... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/config/initializers/backtrace_silencers.rb | test/dummy/config/initializers/backtrace_silencers.rb | # Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a probl... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/config/initializers/mime_types.rb | test/dummy/config/initializers/mime_types.rb | # Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/config/initializers/secret_token.rb | test/dummy/config/initializers/secret_token.rb | # Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to diction... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/config/environments/test.rb | test/dummy/config/environments/test.rb | Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test sui... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/config/environments/development.rb | test/dummy/config/environments/development.rb | Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web ser... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/test/dummy/config/environments/production.rb | test/dummy/config/environments/production.rb | Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web server... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/lib/x-editable-rails.rb | lib/x-editable-rails.rb | require 'x-editable-rails/version'
require 'x-editable-rails/configuration'
require 'x-editable-rails/view_helpers'
module X
module Editable
module Rails
class Engine < ::Rails::Engine
initializer 'x-editable-rails.view_helpers' do
ActionView::Base.send :include, ViewHelpers
end
... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/lib/x-editable-rails/version.rb | lib/x-editable-rails/version.rb | module X
module Editable
module Rails
VERSION = "1.5.5.1"
end
end
end
| ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/lib/x-editable-rails/view_helpers.rb | lib/x-editable-rails/view_helpers.rb | require 'base64'
module X
module Editable
module Rails
module ViewHelpers
#
# Options determine how the HTML tag is rendered and the remaining options are converted to data-* attributes.
#
# options:
# tag: tag name of element returned
# class: "class" ... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/lib/x-editable-rails/configuration.rb | lib/x-editable-rails/configuration.rb | module X
module Editable
module Rails
module Configuration
def method_options_for(object, method)
class_options_for(object).fetch(method, {})
end
def class_options_for(object)
class_options = options.fetch(:class_options, {})
class_opti... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
werein/x-editable-rails | https://github.com/werein/x-editable-rails/blob/2ce5fecc45fb300b2beccbc4d9b822b06fea9afc/lib/generators/x_editable_rails/install_generator.rb | lib/generators/x_editable_rails/install_generator.rb | module XEditableRails
module Generators
class InstallGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
desc 'Copy example of x-editable config'
def copy_x_editable_yml
template 'x-editable.yml', 'config/x-editable.yml'
end
end
end
... | ruby | MIT | 2ce5fecc45fb300b2beccbc4d9b822b06fea9afc | 2026-01-04T17:33:12.788176Z | false |
fatkodima/pluck_in_batches | https://github.com/fatkodima/pluck_in_batches/blob/99ea6a1caf681fa131c8d6f46e129dc047c7937c/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "pluck_in_batches"
require "sqlite3"
require "securerandom"
require "minitest/autorun"
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
if ENV["VERBOSE"]
ActiveRecord::Base.logger = Active... | ruby | MIT | 99ea6a1caf681fa131c8d6f46e129dc047c7937c | 2026-01-04T17:33:14.889743Z | false |
fatkodima/pluck_in_batches | https://github.com/fatkodima/pluck_in_batches/blob/99ea6a1caf681fa131c8d6f46e129dc047c7937c/test/pluck_in_batches_test.rb | test/pluck_in_batches_test.rb | # frozen_string_literal: true
require "test_helper"
class PluckInBatchesTest < TestCase
def test_pluck_each_requires_columns
error = assert_raises(ArgumentError) do
User.pluck_each
end
assert_match("Call `pluck_each' with at least one column.", error.message)
end
def test_pluck_each_should_re... | ruby | MIT | 99ea6a1caf681fa131c8d6f46e129dc047c7937c | 2026-01-04T17:33:14.889743Z | false |
fatkodima/pluck_in_batches | https://github.com/fatkodima/pluck_in_batches/blob/99ea6a1caf681fa131c8d6f46e129dc047c7937c/test/support/models.rb | test/support/models.rb | # frozen_string_literal: true
class User < ActiveRecord::Base
end
class UserWithDefaultScope < ActiveRecord::Base
self.table_name = :users
default_scope { order(name: :desc) }
end
class SpecialUserWithDefaultScope < ActiveRecord::Base
self.table_name = :users
default_scope { where(id: [1, 5, 6]) }
end
class... | ruby | MIT | 99ea6a1caf681fa131c8d6f46e129dc047c7937c | 2026-01-04T17:33:14.889743Z | false |
fatkodima/pluck_in_batches | https://github.com/fatkodima/pluck_in_batches/blob/99ea6a1caf681fa131c8d6f46e129dc047c7937c/test/support/schema.rb | test/support/schema.rb | # frozen_string_literal: true
ActiveRecord::Schema.define do
create_table :users, force: true do |t|
t.string :name
t.json :metadata, null: false, default: {}
end
create_table :subscribers, id: false, primary_key: :nick, force: true do |t|
t.string :nick
t.string :name
end
create_table :pro... | ruby | MIT | 99ea6a1caf681fa131c8d6f46e129dc047c7937c | 2026-01-04T17:33:14.889743Z | false |
fatkodima/pluck_in_batches | https://github.com/fatkodima/pluck_in_batches/blob/99ea6a1caf681fa131c8d6f46e129dc047c7937c/lib/pluck_in_batches.rb | lib/pluck_in_batches.rb | # frozen_string_literal: true
require "active_record"
require_relative "pluck_in_batches/iterator"
require_relative "pluck_in_batches/extensions"
require_relative "pluck_in_batches/version"
module PluckInBatches
end
ActiveSupport.on_load(:active_record) do
extend(PluckInBatches::Extensions::ModelExtension)
Acti... | ruby | MIT | 99ea6a1caf681fa131c8d6f46e129dc047c7937c | 2026-01-04T17:33:14.889743Z | false |
fatkodima/pluck_in_batches | https://github.com/fatkodima/pluck_in_batches/blob/99ea6a1caf681fa131c8d6f46e129dc047c7937c/lib/pluck_in_batches/version.rb | lib/pluck_in_batches/version.rb | # frozen_string_literal: true
module PluckInBatches
VERSION = "0.3.0"
end
| ruby | MIT | 99ea6a1caf681fa131c8d6f46e129dc047c7937c | 2026-01-04T17:33:14.889743Z | false |
fatkodima/pluck_in_batches | https://github.com/fatkodima/pluck_in_batches/blob/99ea6a1caf681fa131c8d6f46e129dc047c7937c/lib/pluck_in_batches/extensions.rb | lib/pluck_in_batches/extensions.rb | # frozen_string_literal: true
module PluckInBatches
module Extensions
module ModelExtension
delegate :pluck_each, :pluck_in_batches, to: :all
end
module RelationExtension
# Yields each set of values corresponding to the specified columns that was found
# by the passed options. If one c... | ruby | MIT | 99ea6a1caf681fa131c8d6f46e129dc047c7937c | 2026-01-04T17:33:14.889743Z | false |
fatkodima/pluck_in_batches | https://github.com/fatkodima/pluck_in_batches/blob/99ea6a1caf681fa131c8d6f46e129dc047c7937c/lib/pluck_in_batches/iterator.rb | lib/pluck_in_batches/iterator.rb | # frozen_string_literal: true
module PluckInBatches
class Iterator # :nodoc:
VALID_ORDERS = [:asc, :desc].freeze
DEFAULT_ORDER = :asc
def initialize(relation)
@relation = relation
@klass = relation.klass
end
def each(*columns, start: nil, finish: nil, batch_size: 1000, error_on_igno... | ruby | MIT | 99ea6a1caf681fa131c8d6f46e129dc047c7937c | 2026-01-04T17:33:14.889743Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/dump_object_space_procs.rb | spec/dump_object_space_procs.rb | require File.join(File.dirname(File.expand_path(__FILE__)), '..', 'lib', 'sourcify')
require 'benchmark'
require 'pp'
if RUBY_PLATFORM =~ /java/i
require 'jruby'
JRuby.objectspace = true
reload! rescue nil
end
DUMPED_OBJECT_SPACE_PROCS = {:max => nil, :done => 0}
DUMP_OBJECT_SPACE_PROCS_ERRORS = []
class STOP_D... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/spec_helper.rb | spec/spec_helper.rb | require 'rubygems'
require 'ruby_parser'
require 'ruby2ruby'
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'sourcify'
# ///////////////////////////////////////////////////////////
# Bacon
# ////////////////////////////////////////////////////////... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/no_method/unsupported_platform_spec.rb | spec/no_method/unsupported_platform_spec.rb | require File.expand_path('../../spec_helper', __FILE__)
describe "Unsupported Platform" do
thing = Class.new do
def self.echo
end
end
should 'raise Sourcify::PlatformNotSupportedError when calling Method#to_source' do
lambda{ thing.method(:echo).to_source }.should.
raise(Sourcify::PlatformNot... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/encoding_from_def_end_block_spec.rb | spec/method/encoding_from_def_end_block_spec.rb | # -*- coding: utf-8 -*-
require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Encoding (from def..end block)" do
next unless Sourcify::IS_19x
should "handle body as UTF-8 string" do
def m1; "こんにちは"; end
method(:m1).should.be having_sexp(
s(:defn, :m1, s(:args), s(:scop... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_sexp_from_define_method_w_variables_spec.rb | spec/method/to_sexp_from_define_method_w_variables_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_sexp (from define_method)' do
describe 'variables' do
before { @thing = Object.new }
should 'handle non var' do
blk = lambda { x }
@thing.class.send(:define_method, :m1, &blk)
@thing.method(:m1)... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_block_w_nested_method_spec.rb | spec/method/to_source_from_def_end_block_w_nested_method_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_source (from def ... end block)" do
describe "w nested method" do
should 'handle simple' do
def m1
def aa; x = 1; end
end
method(:m1).should.be having_source(%(
def m1
def a... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_block_w_19_extras_spec.rb | spec/method/to_source_from_def_end_block_w_19_extras_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_source (from def ... end block)" do
describe "w 19 extras" do
if RUBY_VERSION.include?('1.9.')
should 'handle simple (w label keys)' do
def m1; {a: 1, b: 2}; end
method(:m1).should.be having_sour... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_block_w_nested_do_end_block_spec.rb | spec/method/to_source_from_def_end_block_w_nested_do_end_block_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_source (from def ... end block)" do
describe "w nested do ... end block" do
should 'handle simple' do
def m1
lambda do @x1 = 1 end
end
method(:m1).should.be having_source(%(
def m1
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_define_method_within_pry_spec.rb | spec/method/to_source_from_define_method_within_pry_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from define_method)' do
describe 'within PRY' do
class << self
def pry_eval(string)
pry_exec(string)[-1]
end
def equal_to(expected)
lambda {|found| normalize_code(found) == ... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/others_from_def_end_block_spec.rb | spec/method/others_from_def_end_block_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Misc (from def..end block)" do
should 'handle accessing #to_sexp after #to_source' do
def m1; x; end
(m = method(:m1)).to_source
m.should.be having_sexp(
s(:defn, :m1, s(:args), s(:scope, s(:block, s(:call, nil, :... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_define_method_within_irb_spec.rb | spec/method/to_source_from_define_method_within_irb_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from define_method)' do
describe 'within IRB' do
class << self
def irb_eval(string)
irb_exec(string)[-1]
end
def equal_to(expected)
lambda {|found| normalize_code(found) == ... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_define_method_w_braced_block_spec.rb | spec/method/to_source_from_define_method_w_braced_block_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_source (from define_method)" do
describe "w braced block" do
before { @thing = Object.new }
describe 'w block declared elsewhere' do
should 'wo arg' do
blk = lambda { x = 1 }
@thing.class.s... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_block_w_singleton_method_spec.rb | spec/method/to_source_from_def_end_block_w_singleton_method_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from def ... end block)' do
describe 'w singleton method' do
should 'strip object' do
thing = Object.new
def m
@x1 = 1
end
method(:m).should.be having_source(%(
def m
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_define_method_w_multi_blocks_and_specified_ignore_nested_spec.rb | spec/method/to_source_from_define_method_w_multi_blocks_and_specified_ignore_nested_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source w specified {:ignore_nested => ...} (for defind_method)' do
before { @thing = Object.new }
options = {:ignore_nested => true}
if has_parsetree?
# TODO: Should we support parsetree ??
else
should "ra... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/others_from_define_method_spec.rb | spec/method/others_from_define_method_spec.rb | # -*- coding: utf-8 -*-
require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Misc (from define_method)" do
before { @thing = Object.new }
should 'handle accessing #to_sexp after #to_source' do
blk = lambda { x }
@thing.class.send(:define_method, :m1, &blk)
(m = @thing.... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_block_w_nested_unless_spec.rb | spec/method/to_source_from_def_end_block_w_nested_unless_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_source (from def ... end block)" do
describe "w nested unless" do
should 'handle simple block' do
def m1
unless @x1 then @x1 = 1 end
end
method(:m1).should.be having_source(%(
def m1
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_block_w_nested_for_spec.rb | spec/method/to_source_from_def_end_block_w_nested_for_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_source (from def ... end block)" do
describe "w nested for block" do
should 'handle w do' do
def m1
for x1 in [1,2] do x1 end
end
method(:m1).should.be having_source(%(
def m1
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_define_method_w_multi_blocks_and_specified_attached_to_and_many_matches_spec.rb | spec/method/to_source_from_define_method_w_multi_blocks_and_specified_attached_to_and_many_matches_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from define_method)' do
describe 'w specified {:attached_to => ...} & single match' do
before { @thing = Object.new }
options = {:attached_to => :lambda}
if has_parsetree?
# TODO: Should we supp... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_define_method_w_multi_blocks_and_many_matches_spec.rb | spec/method/to_source_from_define_method_w_multi_blocks_and_many_matches_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from #define_method)' do
describe 'w multi blocks and many matches' do
if has_parsetree?
# TODO: Should we support this ??
else
before { @thing = Object.new }
error = Sourcify::MultipleM... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_define_method_w_multi_blocks_and_specified_body_matcher_and_many_matches_spec.rb | spec/method/to_source_from_define_method_w_multi_blocks_and_specified_body_matcher_and_many_matches_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from define_method)' do
describe 'w specified body matcher & single match' do
before { @thing = Object.new }
matcher = lambda {|code| code =~ /^(.*\W|)alert\W/ }
if has_parsetree?
# TODO: Should... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_define_method_w_multi_blocks_and_specified_body_matcher_and_no_match_spec.rb | spec/method/to_source_from_define_method_w_multi_blocks_and_specified_body_matcher_and_no_match_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from define_method)' do
describe 'w specified body matcher & no match' do
before { @thing = Object.new }
matcher = lambda {|code| code =~ /^(.*\W|)def\W/ }
if has_parsetree?
# TODO: Should we su... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_define_method_w_do_end_block_spec.rb | spec/method/to_source_from_define_method_w_do_end_block_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_source (from define_method)" do
describe "w do..end block" do
before { @thing = Object.new }
describe 'w block declared elsewhere' do
should 'wo arg' do
blk = lambda do
x = 1
end
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_block_w_nested_begin_spec.rb | spec/method/to_source_from_def_end_block_w_nested_begin_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from def ... end block)' do
describe 'w nested begin' do
should 'handle simple' do
def m1
begin @x1 = 1 end
end
method(:m1).should.be having_source(%(
def m1
begin @... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_block_within_irb_spec.rb | spec/method/to_source_from_def_end_block_within_irb_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from def..end block)' do
describe 'within IRB' do
class << self
def irb_eval(string)
irb_exec(string)[-1]
end
def equal_to(expected)
lambda {|found| normalize_code(found) ==... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_block_w_nested_case_spec.rb | spec/method/to_source_from_def_end_block_w_nested_case_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_source (from def ... end block)" do
describe "w nested case" do
should 'handle simple' do
def m1
case @x1 when true then false end
end
method(:m1).should.be having_source(%(
def m1
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_sexp_from_def_end_block_within_irb_spec.rb | spec/method/to_sexp_from_def_end_block_within_irb_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_sexp (from def..end block)' do
describe 'within IRB' do
class << self
def irb_eval(string)
irb_exec(string)[-1]
end
def equal_to(expected)
lambda {|found| found == expected }
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_magic_line_var_spec.rb | spec/method/to_source_magic_line_var_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_source (magic var __LINE__)" do
should 'handle single standalone' do
def m1; __LINE__; end
method(:m1).should.be having_source(%(
def m1; #{__LINE__ - 2}; end
))
end
should 'handle multiple standalo... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_sexp_from_define_method_within_irb_spec.rb | spec/method/to_sexp_from_define_method_within_irb_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_sexp (from define_method)' do
describe 'within IRB' do
class << self
def irb_eval(string)
irb_exec(string)[-1]
end
def equal_to(expected)
lambda {|found| found == expected }
e... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_w_multi_blocks_and_single_match_spec.rb | spec/method/to_source_from_def_end_w_multi_blocks_and_single_match_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from def...end)' do
describe 'w single blocks and many matches' do
should 'skip non-matching w no nesting on same line' do
def m1(a); @x1; end; def m1(b); @x2; end
method(:m1).should.be having_sour... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_w_specified_strip_enclosure_spec.rb | spec/method/to_source_w_specified_strip_enclosure_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source' do
describe 'w specified {:strip_enclosure => ...}' do
describe '>> w true' do
options = {:strip_enclosure => true}
should 'strip enclosing proc wo arg' do
def m1; a+b; end
method... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_sexp_from_def_end_block_within_pry_spec.rb | spec/method/to_sexp_from_def_end_block_within_pry_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_sexp (from def..end block)' do
describe 'within PRY' do
class << self
def pry_eval(string)
pry_exec(string)[-1]
end
def equal_to(expected)
lambda {|found| found == expected }
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_sexp_w_specified_strip_enclosure_spec.rb | spec/method/to_sexp_w_specified_strip_enclosure_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_sexp' do
describe 'w specified {:strip_enclosure => ...}' do
describe '>> w true' do
options = {:strip_enclosure => true}
should 'strip enclosing proc wo arg' do
def m1; a+b; end
method(:... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_define_method_w_multi_blocks_and_single_match_spec.rb | spec/method/to_source_from_define_method_w_multi_blocks_and_single_match_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from define_method)' do
describe 'w single blocks and many matches' do
before { @thing = Object.new }
describe 'w do...end block' do
should 'skip non-matching w no nesting on same line' do
b... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_block_w_nested_until_spec.rb | spec/method/to_source_from_def_end_block_w_nested_until_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_source (from def ... end block)" do
describe "w nested until block" do
should 'handle w do' do
def m1
until true do @x1 = 1 end
end
method(:m1).should.be having_source(%(
def m1
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_define_method_w_multi_blocks_and_specified_body_matcher_and_single_match_spec.rb | spec/method/to_source_from_define_method_w_multi_blocks_and_specified_body_matcher_and_single_match_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from define_method)' do
describe 'w specified body matcher & single match' do
before { @thing = Object.new }
matcher = lambda {|code| code =~ /^(.*\W|)alert\W/ }
should 'handle no nesting on same line... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_block_w_nested_class_spec.rb | spec/method/to_source_from_def_end_block_w_nested_class_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_source (from def ... end block)" do
describe "w nested class" do
class AA; end
should 'handle singleton' do
def m1
class << AA
def aa
@x1 = 1
end
end
en... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_block_w_nested_literal_keyword_spec.rb | spec/method/to_source_from_def_end_block_w_nested_literal_keyword_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_source (from def ... end block)" do
describe "w nested literal keyword" do
# See http://redmine.ruby-lang.org/issues/show/3764
should 'handle :class' do
def m1
x = :class
end
method(:m1)... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/encoding_from_define_method_spec.rb | spec/method/encoding_from_define_method_spec.rb | # -*- coding: utf-8 -*-
require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Encoding (from define_method)" do
next unless Sourcify::IS_19x
before { @thing = Object.new }
should "handle body as UTF-8 string" do
b = lambda { "こんにちは" }
@thing.class.send(:define_method, :m1... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_sexp_from_define_method_within_pry_spec.rb | spec/method/to_sexp_from_define_method_within_pry_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_sexp (from define_method)' do
describe 'within PRY' do
class << self
def pry_eval(string)
pry_exec(string)[-1]
end
def equal_to(expected)
lambda {|found| found == expected }
e... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_w_multi_blocks_and_many_matches_spec.rb | spec/method/to_source_from_def_end_w_multi_blocks_and_many_matches_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from def...end block)' do
describe 'w multi blocks and many matches' do
if has_parsetree?
# TODO: Should we support this ??
else
error = Sourcify::MultipleMatchingMethodsPerLineError
sh... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_sexp_from_define_method_w_multi_blocks_and_specified_attached_to_spec.rb | spec/method/to_sexp_from_define_method_w_multi_blocks_and_specified_attached_to_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_sexp (from define_method)' do
describe 'w specified {:attached_to => ...}' do
# NOTE: We just want enough specs to show that handling of :attached_to
# works for Method#to_sexp as well.
before { @thing = Obje... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_block_within_pry_spec.rb | spec/method/to_source_from_def_end_block_within_pry_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from def..end block)' do
describe 'within PRY' do
class << self
def pry_eval(string)
pry_exec(string)[-1]
end
def equal_to(expected)
lambda {|found| normalize_code(found) ==... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_define_method_w_multi_blocks_and_specified_attached_to_spec.rb | spec/method/to_source_from_define_method_w_multi_blocks_and_specified_attached_to_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from define_method)' do
describe 'w specified {:attached_to => ...}' do
if has_parsetree?
# TODO: Should we support this ??
else
before { @thing = Object.new }
err1 = Sourcify::Multiple... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_magic_file_var_spec.rb | spec/method/to_source_magic_file_var_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_source (magic var __FILE__)" do
should 'handle single standalone' do
def m1; __FILE__; end
method(:m1).should.be having_source(%(
def m1; "#{__FILE__}"; end
))
end
should 'handle multiple standalone... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_sexp_from_def_end_block_w_variables_spec.rb | spec/method/to_sexp_from_def_end_block_w_variables_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_sexp (from def..end block)' do
describe 'variables' do
should 'handle non var' do
def m1; x; end
method(:m1).should.be having_sexp(
s(:defn, :m1, s(:args), s(:scope, s(:block, s(:call, nil, :x, s(:... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_raw_source_w_specified_strip_enclosure_spec.rb | spec/method/to_raw_source_w_specified_strip_enclosure_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_raw_source' do
describe 'w specified {:strip_enclosure => ...}' do
describe '>> w true' do
options = {:strip_enclosure => true}
should 'strip enclosing def..end wo arg' do
def m
# i sho... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_raw_source_spec.rb | spec/method/to_raw_source_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_raw_source" do
should 'retain comments' do
def m1
a = 1
# i should stay !!
end
method(:m1).should.be having_raw_source(%(
def m1
a = 1
# i should stay !!
end
))
end
sho... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_block_w_nested_while_spec.rb | spec/method/to_source_from_def_end_block_w_nested_while_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_source (from def ... end block)" do
describe "w nested while block" do
should 'handle w do' do
def m1
while true do @x1 = 1 end
end
method(:m1).should.be having_source(%(
def m1
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_define_method_w_multi_blocks_and_specified_attached_to_and_no_match_spec.rb | spec/method/to_source_from_define_method_w_multi_blocks_and_specified_attached_to_and_no_match_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from define_method)' do
describe 'w specified {:attached_to => ...} & no match' do
before { @thing = Object.new }
options = {:attached_to => :forever}
if has_parsetree?
# TODO: Should we support... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/spec_helper.rb | spec/method/spec_helper.rb | require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'spec_helper')
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_define_method_w_multi_blocks_and_specified_attached_to_and_single_match_spec.rb | spec/method/to_source_from_define_method_w_multi_blocks_and_specified_attached_to_and_single_match_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Method#to_source (from define_method)' do
describe 'w specified {:attached_to => ...} & single match' do
before { @thing = Object.new }
options = {:attached_to => :watever}
should 'handle no nesting on same line' do
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_block_w_nested_if_spec.rb | spec/method/to_source_from_def_end_block_w_nested_if_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_source (from def ... end block)" do
describe "w nested if" do
should 'handle simple block' do
def m1
if @x1 then @x1 = 1 end
end
method(:m1).should.be having_source(%(
def m1
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/to_source_from_def_end_block_w_nested_module_spec.rb | spec/method/to_source_from_def_end_block_w_nested_module_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Method#to_source (from def ... end block)" do
describe "w nested module" do
class AA; end
should 'handle simple' do
def m1
class << AA
module BB
def aa
@x1 = 1
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/raw_scanner/double_quote_str_wo_interpolation_spec.rb | spec/method/raw_scanner/double_quote_str_wo_interpolation_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Method's raw scanner > double quote strings (wo interpolation)" do
extend Sourcify::Method::Parser::RawScanner::Spec::GenericSupport
behaves_like "Double quote strings (wo interpolation)"
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/raw_scanner/double_colons_spec.rb | spec/method/raw_scanner/double_colons_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Method's raw scanner > double colons" do
extend Sourcify::Method::Parser::RawScanner::Spec::GenericSupport
behaves_like "Double colons"
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/raw_scanner/per_line_comment_spec.rb | spec/method/raw_scanner/per_line_comment_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Method's raw scanner > per line comment (# ...)" do
extend Sourcify::Method::Parser::RawScanner::Spec::GenericSupport
behaves_like "Per line comment (# ...)"
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/raw_scanner/kw_block_start_alias2_spec.rb | spec/method/raw_scanner/kw_block_start_alias2_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Method's raw scanner > keyword block start alias #2 (incrementing counter by 0..1)" do
extend Sourcify::Method::Parser::RawScanner::Spec::KwBlockStartSupport
behaves_like "Keyword block start alias #2 (incrementing counter ... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/raw_scanner/single_quote_str_spec.rb | spec/method/raw_scanner/single_quote_str_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Method's raw scanner > single quote strings (\', %q & %w)" do
extend Sourcify::Method::Parser::RawScanner::Spec::GenericSupport
behaves_like 'Single quote strings (\', %q & %w)'
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/raw_scanner/kw_block_start_alias1_spec.rb | spec/method/raw_scanner/kw_block_start_alias1_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Method's raw scanner > keyword block start alias #1 (incrementing counter by 1)" do
extend Sourcify::Method::Parser::RawScanner::Spec::KwBlockStartSupport
behaves_like "Keyword block start alias #1 (incrementing counter by ... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.