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 |
|---|---|---|---|---|---|---|---|---|
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/parser.rb | lib/slim/parser.rb | # frozen_string_literal: true
module Slim
# Parses Slim code and transforms it to a Temple expression
# @api private
class Parser < Temple::Parser
define_options :file,
:default_tag,
tabsize: 4,
code_attr_delims: {
'(' => ')',
... | ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/erb_converter.rb | lib/slim/erb_converter.rb | # frozen_string_literal: true
require 'slim'
module Slim
# Slim to ERB converter
#
# @example Conversion
# Slim::ERBConverter.new(options).call(slim_code) # outputs erb_code
#
# @api public
class ERBConverter < Engine
replace :StaticMerger, Temple::Filters::CodeMerger
replace :Generator, Temple... | ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/translator.rb | lib/slim/translator.rb | # frozen_string_literal: true
require 'slim'
module Slim
# @api private
class Translator < Filter
define_options :tr,
tr_mode: :dynamic,
tr_fn: '_'
if defined?(::I18n)
set_options tr_fn: '::Slim::Translator.i18n_text',
tr: true
elsif define... | ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/railtie.rb | lib/slim/railtie.rb | # frozen_string_literal: true
module Slim
class Railtie < ::Rails::Railtie
initializer 'initialize slim template handler' do
ActiveSupport.on_load(:action_view) do
Slim::RailsTemplate = Temple::Templates::Rails(Slim::Engine,
register_as: :slim,... | ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/logic_less.rb | lib/slim/logic_less.rb | # frozen_string_literal: true
require 'slim'
require 'slim/logic_less/filter'
require 'slim/logic_less/context'
Slim::Engine.after Slim::Interpolation, Slim::LogicLess
| ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/code_attributes.rb | lib/slim/code_attributes.rb | # frozen_string_literal: true
module Slim
# @api private
class CodeAttributes < Filter
define_options :merge_attrs
# Handle attributes expression `[:html, :attrs, *attrs]`
#
# @param [Array] attrs Array of temple expressions
# @return [Array] Compiled temple expression
def on_html_attrs(*at... | ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/controls.rb | lib/slim/controls.rb | # frozen_string_literal: true
module Slim
# @api private
class Controls < Filter
define_options :disable_capture
IF_RE = /\A(if|unless)\b|\bdo\s*(\|[^\|]*\|)?\s*$/
# Handle control expression `[:slim, :control, code, content]`
#
# @param [String] code Ruby code
# @param [Array] content Tem... | ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/smart.rb | lib/slim/smart.rb | # frozen_string_literal: true
require 'slim'
require 'slim/smart/filter'
require 'slim/smart/escaper'
require 'slim/smart/parser'
Slim::Engine.replace Slim::Parser, Slim::Smart::Parser
Slim::Engine.after Slim::Smart::Parser, Slim::Smart::Filter
Slim::Engine.after Slim::Interpolation, Slim::Smart::Escaper
| ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/template.rb | lib/slim/template.rb | # frozen_string_literal: true
module Slim
# Tilt template implementation for Slim
# @api public
Template = Temple::Templates::Tilt(Slim::Engine, register_as: :slim)
end
| ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/engine.rb | lib/slim/engine.rb | # frozen_string_literal: true
# The Slim module contains all Slim related classes (e.g. Engine, Parser).
# Plugins might also reside within the Slim module (e.g. Include, Smart).
# @api public
module Slim
# Slim engine which transforms slim code to executable ruby code
# @api public
class Engine < Temple::Engine
... | ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/do_inserter.rb | lib/slim/do_inserter.rb | # frozen_string_literal: true
module Slim
# In Slim you don't need the do keyword sometimes. This
# filter adds the missing keyword.
#
# - 10.times
# | Hello
#
# @api private
class DoInserter < Filter
BLOCK_REGEX = /(\A(if|unless|else|elsif|when|in|begin|rescue|ensure|case)\b)|\bdo\s*(\|[^\|]*... | ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/smart/filter.rb | lib/slim/smart/filter.rb | # frozen_string_literal: true
module Slim
module Smart
# Perform newline processing in the
# expressions `[:slim, :text, type, Expression]`.
#
# @api private
class Filter < ::Slim::Filter
define_options smart_text: true,
smart_text_end_chars: '([{',
... | ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/smart/parser.rb | lib/slim/smart/parser.rb | # frozen_string_literal: true
module Slim
module Smart
# @api private
class Parser < ::Slim::Parser
define_options implicit_text: true
def initialize(opts = {})
super
word_re = options[:implicit_text] ? '[_a-z0-9]' : '\p{Word}'
attr_keys = Regexp.union(@attr_shortcut.keys.... | ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/smart/escaper.rb | lib/slim/smart/escaper.rb | # frozen_string_literal: true
module Slim
module Smart
# Perform smart entity escaping in the
# expressions `[:slim, :text, type, Expression]`.
#
# @api private
class Escaper < ::Slim::Filter
define_options smart_text_escaping: true
def call(exp)
if options[:smart_text_escapin... | ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/splat/filter.rb | lib/slim/splat/filter.rb | # frozen_string_literal: true
module Slim
module Splat
# @api private
class Filter < ::Slim::Filter
define_options :merge_attrs, :attr_quote, :sort_attrs, :default_tag, :format, :disable_capture,
hyphen_attrs: %w(data aria), use_html_safe: ''.respond_to?(:html_safe?),
... | ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/splat/builder.rb | lib/slim/splat/builder.rb | # frozen_string_literal: true
module Slim
class InvalidAttributeNameError < StandardError; end
module Splat
# @api private
class Builder
# https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
INVALID_ATTRIBUTE_NAME_REGEX = /[ \0"'>\/=]/
def initialize(options)
@options ... | ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/logic_less/filter.rb | lib/slim/logic_less/filter.rb | # frozen_string_literal: true
module Slim
# Handle logic less mode
# This filter can be activated with the option "logic_less"
# @api private
class LogicLess < Filter
# Default dictionary access order, change it with the option :dictionary_access
DEFAULT_ACCESS_ORDER = [:symbol, :string, :method, :insta... | ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
slim-template/slim | https://github.com/slim-template/slim/blob/d387587ae364f489b3e23126e204907a0b134bd3/lib/slim/logic_less/context.rb | lib/slim/logic_less/context.rb | # frozen_string_literal: true
module Slim
class LogicLess
# @api private
class Context
def initialize(dict, lookup)
@scope = [Scope.new(dict, lookup)]
end
def [](name)
scope[name]
end
def lambda(name)
scope.lambda(name) do |*dict|
if dict.empty... | ruby | MIT | d387587ae364f489b3e23126e204907a0b134bd3 | 2026-01-04T15:43:07.251246Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/helpers.rb | spec/helpers.rb | require 'uri'
module Helpers
# @param [Hash] opts A hash of methods, passed directly to the double
# definition. Use this to stub other required methods.
#
# @return double for Net::HTTPResponse
def res_double(opts={})
instance_double('Net::HTTPResponse', {to_hash: {}, body: 'response body'}.merge(opt... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/spec_helper.rb | spec/spec_helper.rb | require 'webmock/rspec'
require 'rest-client'
require_relative './helpers'
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.raise_errors_for_deprecations!
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want t... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/integration/_lib.rb | spec/integration/_lib.rb | require_relative '../spec_helper'
| ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/integration/request_spec.rb | spec/integration/request_spec.rb | require_relative '_lib'
describe RestClient::Request do
before(:all) do
WebMock.disable!
end
after(:all) do
WebMock.enable!
end
describe "ssl verification" do
it "is successful with the correct ca_file" do
request = RestClient::Request.new(
:method => :get,
:url => 'https:... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/integration/integration_spec.rb | spec/integration/integration_spec.rb | # -*- coding: utf-8 -*-
require_relative '_lib'
require 'base64'
describe RestClient do
it "a simple request" do
body = 'abc'
stub_request(:get, "www.example.com").to_return(:body => body, :status => 200)
response = RestClient.get "www.example.com"
expect(response.code).to eq 200
expect(response... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/integration/httpbin_spec.rb | spec/integration/httpbin_spec.rb | require_relative '_lib'
require 'json'
require 'zlib'
describe RestClient::Request do
before(:all) do
WebMock.disable!
end
after(:all) do
WebMock.enable!
end
def default_httpbin_url
# add a hack to work around java/jruby bug
# java.lang.RuntimeException: Could not generate DH keypair with ... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/unit/raw_response_spec.rb | spec/unit/raw_response_spec.rb | require_relative '_lib'
describe RestClient::RawResponse do
before do
@tf = double("Tempfile", :read => "the answer is 42", :open => true, :rewind => true)
@net_http_res = double('net http response')
@request = double('restclient request', :redirection_history => nil)
@response = RestClient::RawRespo... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/unit/response_spec.rb | spec/unit/response_spec.rb | require_relative '_lib'
describe RestClient::Response, :include_helpers do
before do
@net_http_res = res_double(to_hash: {'Status' => ['200 OK']}, code: '200', body: 'abc')
@example_url = 'http://example.com'
@request = request_double(url: @example_url, method: 'get')
@response = response_from_res_do... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/unit/_lib.rb | spec/unit/_lib.rb | require_relative '../spec_helper'
| ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/unit/request_spec.rb | spec/unit/request_spec.rb | require_relative './_lib'
describe RestClient::Request, :include_helpers do
before do
@request = RestClient::Request.new(:method => :put, :url => 'http://some/resource', :payload => 'payload')
@uri = double("uri")
allow(@uri).to receive(:request_uri).and_return('/resource')
allow(@uri).to receive(:h... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | true |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/unit/exceptions_spec.rb | spec/unit/exceptions_spec.rb | require_relative '_lib'
describe RestClient::Exception do
it "returns a 'message' equal to the class name if the message is not set, because 'message' should not be nil" do
e = RestClient::Exception.new
expect(e.message).to eq "RestClient::Exception"
end
it "returns the 'message' that was set" do
e ... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/unit/restclient_spec.rb | spec/unit/restclient_spec.rb | require_relative '_lib'
describe RestClient do
describe "API" do
it "GET" do
expect(RestClient::Request).to receive(:execute).with(:method => :get, :url => 'http://some/resource', :headers => {})
RestClient.get('http://some/resource')
end
it "POST" do
expect(RestClient::Request).to rec... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/unit/payload_spec.rb | spec/unit/payload_spec.rb | # encoding: binary
require_relative '_lib'
describe RestClient::Payload, :include_helpers do
context "Base Payload" do
it "should reset stream after to_s" do
payload = RestClient::Payload::Base.new('foobar')
expect(payload.to_s).to eq 'foobar'
expect(payload.to_s).to eq 'foobar'
end
end
... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/unit/utils_spec.rb | spec/unit/utils_spec.rb | require_relative '_lib'
describe RestClient::Utils do
describe '.get_encoding_from_headers' do
it 'assumes no encoding by default for text' do
headers = {:content_type => 'text/plain'}
expect(RestClient::Utils.get_encoding_from_headers(headers)).
to eq nil
end
it 'returns nil on fail... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/unit/request2_spec.rb | spec/unit/request2_spec.rb | require_relative '_lib'
describe RestClient::Request, :include_helpers do
context 'params for GET requests' do
it "manage params for get requests" do
stub_request(:get, 'http://some/resource?a=b&c=d').with(:headers => {'Accept'=>'*/*', 'Foo'=>'bar'}).to_return(:body => 'foo', :status => 200)
expect(... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/unit/params_array_spec.rb | spec/unit/params_array_spec.rb | require_relative '_lib'
describe RestClient::ParamsArray do
describe '.new' do
it 'accepts various types of containers' do
as_array = [[:foo, 123], [:foo, 456], [:bar, 789], [:empty, nil]]
[
[[:foo, 123], [:foo, 456], [:bar, 789], [:empty, nil]],
[{foo: 123}, {foo: 456}, {bar: 789}, ... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/unit/abstract_response_spec.rb | spec/unit/abstract_response_spec.rb | require_relative '_lib'
describe RestClient::AbstractResponse, :include_helpers do
# Sample class implementing AbstractResponse used for testing.
class MyAbstractResponse
include RestClient::AbstractResponse
attr_accessor :size
def initialize(net_http_res, request)
response_set_vars(net_http_... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/unit/resource_spec.rb | spec/unit/resource_spec.rb | require_relative '_lib'
describe RestClient::Resource do
before do
@resource = RestClient::Resource.new('http://some/resource', :user => 'jane', :password => 'mypass', :headers => {'X-Something' => '1'})
end
context "Resource delegation" do
it "GET" do
expect(RestClient::Request).to receive(:execu... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/spec/unit/windows/root_certs_spec.rb | spec/unit/windows/root_certs_spec.rb | require_relative '../_lib'
describe 'RestClient::Windows::RootCerts',
:if => RestClient::Platform.windows? do
let(:x509_store) { RestClient::Windows::RootCerts.instance.to_a }
it 'should return at least one X509 certificate' do
expect(x509_store.to_a.size).to be >= 1
end
it 'should return an X50... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/restclient.rb | lib/restclient.rb | require 'net/http'
require 'openssl'
require 'stringio'
require 'uri'
require File.dirname(__FILE__) + '/restclient/version'
require File.dirname(__FILE__) + '/restclient/platform'
require File.dirname(__FILE__) + '/restclient/exceptions'
require File.dirname(__FILE__) + '/restclient/utils'
require File.dirname(__FILE... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/rest_client.rb | lib/rest_client.rb | # This file exists for backward compatbility with require 'rest_client'
require File.dirname(__FILE__) + '/restclient'
| ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/rest-client.rb | lib/rest-client.rb | # More logical way to require 'rest-client'
require File.dirname(__FILE__) + '/restclient'
| ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/restclient/resource.rb | lib/restclient/resource.rb | module RestClient
# A class that can be instantiated for access to a RESTful resource,
# including authentication.
#
# Example:
#
# resource = RestClient::Resource.new('http://some/resource')
# jpg = resource.get(:accept => 'image/jpg')
#
# With HTTP basic authentication:
#
# resource = Rest... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/restclient/platform.rb | lib/restclient/platform.rb | require 'rbconfig'
module RestClient
module Platform
# Return true if we are running on a darwin-based Ruby platform. This will
# be false for jruby even on OS X.
#
# @return [Boolean]
def self.mac_mri?
RUBY_PLATFORM.include?('darwin')
end
# Return true if we are running on Windows... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/restclient/version.rb | lib/restclient/version.rb | module RestClient
VERSION_INFO = [2, 1, 0].freeze
VERSION = VERSION_INFO.map(&:to_s).join('.').freeze
def self.version
VERSION
end
end
| ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/restclient/exceptions.rb | lib/restclient/exceptions.rb | module RestClient
# Hash of HTTP status code => message.
#
# 1xx: Informational - Request received, continuing process
# 2xx: Success - The action was successfully received, understood, and
# accepted
# 3xx: Redirection - Further action must be taken in order to complete the
# request
# 4xx: ... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/restclient/utils.rb | lib/restclient/utils.rb | require 'http/accept'
module RestClient
# Various utility methods
module Utils
# Return encoding from an HTTP header hash.
#
# We use the RFC 7231 specification and do not impose a default encoding on
# text. This differs from the older RFC 2616 behavior, which specifies
# using ISO-8859-1 for... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/restclient/response.rb | lib/restclient/response.rb | module RestClient
# A Response from RestClient, you can access the response body, the code or the headers.
#
class Response < String
include AbstractResponse
# Return the HTTP response body.
#
# Future versions of RestClient will deprecate treating response objects
# directly as strings, so... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/restclient/abstract_response.rb | lib/restclient/abstract_response.rb | require 'cgi'
require 'http-cookie'
module RestClient
module AbstractResponse
attr_reader :net_http_res, :request, :start_time, :end_time, :duration
def inspect
raise NotImplementedError.new('must override in subclass')
end
# Logger from the request, potentially nil.
def log
reque... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/restclient/params_array.rb | lib/restclient/params_array.rb | module RestClient
# The ParamsArray class is used to represent an ordered list of [key, value]
# pairs. Use this when you need to include a key multiple times or want
# explicit control over parameter ordering.
#
# Most of the request payload & parameter functions normally accept a Hash of
# keys => values... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/restclient/request.rb | lib/restclient/request.rb | require 'tempfile'
require 'cgi'
require 'netrc'
require 'set'
begin
# Use mime/types/columnar if available, for reduced memory usage
require 'mime/types/columnar'
rescue LoadError
require 'mime/types'
end
module RestClient
# This class is used internally by RestClient to send the request, but you can also
... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/restclient/payload.rb | lib/restclient/payload.rb | require 'tempfile'
require 'securerandom'
require 'stringio'
begin
# Use mime/types/columnar if available, for reduced memory usage
require 'mime/types/columnar'
rescue LoadError
require 'mime/types'
end
module RestClient
module Payload
extend self
def generate(params)
if params.is_a?(RestClien... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/restclient/raw_response.rb | lib/restclient/raw_response.rb | module RestClient
# The response from RestClient on a raw request looks like a string, but is
# actually one of these. 99% of the time you're making a rest call all you
# care about is the body, but on the occasion you want to fetch the
# headers you can:
#
# RestClient.get('http://example.com').headers[... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/restclient/windows.rb | lib/restclient/windows.rb | module RestClient
module Windows
end
end
if RestClient::Platform.windows?
require_relative './windows/root_certs'
end
| ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rest-client/rest-client | https://github.com/rest-client/rest-client/blob/2c72a2e77e2e87d25ff38feba0cf048d51bd5eca/lib/restclient/windows/root_certs.rb | lib/restclient/windows/root_certs.rb | require 'openssl'
require 'ffi'
# Adapted from Puppet, Copyright (c) Puppet Labs Inc,
# licensed under the Apache License, Version 2.0.
#
# https://github.com/puppetlabs/puppet/blob/bbe30e0a/lib/puppet/util/windows/root_certs.rb
# Represents a collection of trusted root certificates.
#
# @api public
class RestClient:... | ruby | MIT | 2c72a2e77e2e87d25ff38feba0cf048d51bd5eca | 2026-01-04T15:43:28.362144Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/group_spec.rb | spec/group_spec.rb | require "helper"
describe Thor::Group do
describe "command" do
it "allows to use private methods from parent class as commands" do
expect(ChildGroup.start).to eq(%w(bar foo baz))
expect(ChildGroup.new.baz("bar")).to eq("bar")
end
end
describe "#start" do
it "invokes all the commands unde... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/no_warnings_spec.rb | spec/no_warnings_spec.rb | require "open3"
context "when $VERBOSE is enabled" do
it "prints no warnings" do
root = File.expand_path("..", __dir__)
_, err, = Open3.capture3("ruby -I #{root}/lib #{root}/spec/fixtures/verbose.thor")
expect(err).to be_empty
end
it "prints no warnings even when erroring" do
root = File.expand... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/encoding_spec.rb | spec/encoding_spec.rb | require "helper"
require "thor/base"
describe "file's encoding" do
def load_thorfile(filename)
Thor::Util.load_thorfile(File.expand_path("./fixtures/#{filename}", __dir__))
end
it "respects explicit UTF-8" do
load_thorfile("encoding_with_utf8.thor")
expect(capture(:stdout) { Thor::Sandbox::Encoding... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/quality_spec.rb | spec/quality_spec.rb | describe "The library itself" do
def check_for_spec_defs_with_single_quotes(filename)
failing_lines = []
File.readlines(filename).each_with_index do |line, number|
failing_lines << number + 1 if line =~ /^ *(describe|it|context) {1}'{1}/
end
"#{filename} uses inconsistent single quotes on line... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/script_exit_status_spec.rb | spec/script_exit_status_spec.rb | describe "when the Thor class's exit_with_failure? method returns true" do
def thor_command(command)
gem_dir= File.expand_path("#{File.dirname(__FILE__)}/..")
lib_path= "#{gem_dir}/lib"
script_path= "#{gem_dir}/spec/fixtures/exit_status.thor"
ruby_lib= ENV["RUBYLIB"].nil? ? lib_path : "#{lib_path}:#{E... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/register_spec.rb | spec/register_spec.rb | require "helper"
class BoringVendorProvidedCLI < Thor
desc "boring", "do boring stuff"
def boring
puts "bored. <yawn>"
end
end
class ExcitingPluginCLI < Thor
desc "hooray", "say hooray!"
def hooray
puts "hooray!"
end
desc "fireworks", "exciting fireworks!"
def fireworks
puts "kaboom!"
e... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/thor_spec.rb | spec/thor_spec.rb | require "helper"
describe Thor do
describe "#method_option" do
it "sets options to the next method to be invoked" do
args = %w(foo bar --force)
_, options = MyScript.start(args)
expect(options).to eq("force" => true)
end
describe ":lazy_default" do
it "is absent when option is no... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/actions_spec.rb | spec/actions_spec.rb | require "helper"
describe Thor::Actions do
def runner(options = {})
@runner ||= MyCounter.new([1], options, destination_root: destination_root)
end
def action(*args, &block)
capture(:stdout) { runner.send(*args, &block) }
end
def file
File.join(destination_root, "foo")
end
describe "on inc... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/sort_spec.rb | spec/sort_spec.rb | require "helper"
describe Thor do
def shell
@shell ||= Thor::Base.shell.new
end
describe "#sort - default" do
my_script = Class.new(Thor) do
desc "a", "First Command"
def a; end
desc "z", "Last Command"
def z; end
end
before do
@content = capture(:stdout) { my_scr... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/util_spec.rb | spec/util_spec.rb | require "helper"
module Thor::Util
def self.clear_user_home!
@@user_home = nil
end
end
describe Thor::Util do
describe "#find_by_namespace" do
it "returns 'default' if no namespace is given" do
expect(Thor::Util.find_by_namespace("")).to eq(Scripts::MyDefaults)
end
it "adds 'default' if n... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/subcommand_spec.rb | spec/subcommand_spec.rb | require "helper"
describe Thor do
describe "#subcommand" do
it "maps a given subcommand to another Thor subclass" do
barn_help = capture(:stdout) { Scripts::MyDefaults.start(%w(barn)) }
expect(barn_help).to include("barn help [COMMAND] # Describe subcommands or one specific subcommand")
end
... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/command_spec.rb | spec/command_spec.rb | require "helper"
describe Thor::Command do
def command(options = {}, usage = "can_has")
options.each do |key, value|
options[key] = Thor::Option.parse(key, value)
end
@command ||= Thor::Command.new(:can_has, "I can has cheezburger", "I can has cheezburger\nLots and lots of it", nil, usage, options... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/nested_context_spec.rb | spec/nested_context_spec.rb | require "helper"
describe Thor::NestedContext do
subject(:context) { described_class.new }
describe "#enter" do
it "is never empty within the entered block" do
context.enter do
context.enter {}
expect(context).to be_entered
end
end
it "is empty when outside of all blocks"... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/line_editor_spec.rb | spec/line_editor_spec.rb | require "helper"
require "readline"
describe Thor::LineEditor, "on a system with Readline support" do
before do
@original_readline = ::Readline
Object.send(:remove_const, :Readline)
::Readline = double("Readline")
end
after do
Object.send(:remove_const, :Readline)
::Readline = @original_read... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/rake_compat_spec.rb | spec/rake_compat_spec.rb | require "helper"
require "thor/rake_compat"
require "rake/tasklib"
$main = self
class RakeTask < Rake::TaskLib
def initialize
define
end
def define
$main.instance_eval do
desc "Say it's cool"
task :cool do
puts "COOL"
end
namespace :hiper_mega do
task :super do
... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/shell_spec.rb | spec/shell_spec.rb | require "helper"
describe Thor::Shell do
def shell
@shell ||= Thor::Base.shell.new
end
describe "#initialize" do
it "sets shell value" do
base = MyCounter.new [1, 2], {}, shell: shell
expect(base.shell).to eq(shell)
end
it "sets the base value on the shell if an accessor is availabl... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/base_spec.rb | spec/base_spec.rb | require "helper"
require "thor/base"
class Amazing
desc "hello", "say hello"
def hello
puts "Hello"
end
end
describe Thor::Base do
describe "#initialize" do
it "sets arguments array" do
base = MyCounter.new [1, 2]
expect(base.first).to eq(1)
expect(base.second).to eq(2)
end
... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/exit_condition_spec.rb | spec/exit_condition_spec.rb | require "helper"
require "thor/base"
describe "Exit conditions" do
it "exits 0, not bubble up EPIPE, if EPIPE is raised" do
epiped = false
command = Class.new(Thor) do
desc "my_action", "testing EPIPE"
define_method :my_action do
epiped = true
raise Errno::EPIPE
end
end... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/helper.rb | spec/helper.rb | $TESTING = true
require "simplecov"
require "coveralls"
SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
SimpleCov.start do
add_filter "/spec"
minimum_coverage(90)
end
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
require "thor"
require "thor/gro... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/tree_spec.rb | spec/tree_spec.rb | require "helper"
require "thor"
class TreeApp < Thor
desc "command1", "A top level command"
def command1
end
desc "command2", "Another top level command"
def command2
end
class SubApp < Thor
desc "subcommand1", "A subcommand"
def subcommand1
end
end
desc "sub", "Subcommands"
subco... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/invocation_spec.rb | spec/invocation_spec.rb | require "helper"
require "thor/base"
describe Thor::Invocation do
describe "#invoke" do
it "invokes a command inside another command" do
expect(capture(:stdout) { A.new.invoke(:two) }).to eq("2\n3\n")
end
it "invokes a command just once" do
expect(capture(:stdout) { A.new.invoke(:one) }).to ... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/runner_spec.rb | spec/runner_spec.rb | require "helper"
require "thor/runner"
describe Thor::Runner do
def when_no_thorfiles_exist
old_dir = Dir.pwd
Dir.chdir ".."
delete = Thor::Base.subclasses.select { |e| e.namespace == "default" }
delete.each { |e| Thor::Base.subclasses.delete e }
yield
Thor::Base.subclasses.concat delete
... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/line_editor/readline_spec.rb | spec/line_editor/readline_spec.rb | require "helper"
describe Thor::LineEditor::Readline do
before do
# Eagerly check Readline availability before mocking
Thor::LineEditor::Readline.available?
unless defined? ::Readline
::Readline = double("Readline")
allow(::Readline).to receive(:completion_append_character=).with(nil)
end... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/line_editor/basic_spec.rb | spec/line_editor/basic_spec.rb | require "helper"
describe Thor::LineEditor::Basic do
describe ".available?" do
it "returns true" do
expect(Thor::LineEditor::Basic).to be_available
end
end
describe "#readline" do
it "uses $stdin and $stdout to get input from the user" do
expect($stdout).to receive(:print).with("Enter yo... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/fixtures/application.rb | spec/fixtures/application.rb | class Application < Base
end
| ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/fixtures/application_helper.rb | spec/fixtures/application_helper.rb | module ApplicationHelper
end
| ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/fixtures/doc/block_helper.rb | spec/fixtures/doc/block_helper.rb | <% world do -%>
Hello
<% end -%>
| ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/fixtures/doc/config.rb | spec/fixtures/doc/config.rb | class <%= @klass %>; end
| ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/actions/create_file_spec.rb | spec/actions/create_file_spec.rb | require "helper"
require "thor/actions"
describe Thor::Actions::CreateFile do
before do
@silence = false
::FileUtils.rm_rf(destination_root)
end
def create_file(destination = nil, config = {}, options = {}, contents = "CONFIGURATION")
@base = MyCounter.new([1, 2], options, destination_root: destinat... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/actions/directory_spec.rb | spec/actions/directory_spec.rb | require "tmpdir"
require "helper"
require "thor/actions"
describe Thor::Actions::Directory do
before do
::FileUtils.rm_rf(destination_root)
allow(invoker).to receive(:file_name).and_return("rdoc")
end
def invoker
@invoker ||= WhinyGenerator.new([1, 2], {}, destination_root: destination_root)
end
... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/actions/file_manipulation_spec.rb | spec/actions/file_manipulation_spec.rb | require "helper"
describe Thor::Actions do
def runner(options = {}, behavior = :invoke)
@runner ||= MyCounter.new([1], options, destination_root: destination_root, behavior: behavior)
end
def action(*args, &block)
capture(:stdout) { runner.send(*args, &block) }
end
def exists_and_identical?(source,... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/actions/create_link_spec.rb | spec/actions/create_link_spec.rb | require "helper"
require "thor/actions"
require "tempfile"
describe Thor::Actions::CreateLink, unless: windows? do
before do
@hardlink_to = File.join(Dir.tmpdir, "linkdest.rb")
::FileUtils.rm_rf(destination_root)
::FileUtils.rm_rf(@hardlink_to)
end
let(:config) { {} }
let(:options) { {} }
let(:... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/actions/empty_directory_spec.rb | spec/actions/empty_directory_spec.rb | require "helper"
require "thor/actions"
describe Thor::Actions::EmptyDirectory do
before do
::FileUtils.rm_rf(destination_root)
end
def empty_directory(destination, options = {})
@action = Thor::Actions::EmptyDirectory.new(base, destination)
end
def invoke!
capture(:stdout) { @action.invoke! }
... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/actions/inject_into_file_spec.rb | spec/actions/inject_into_file_spec.rb | # encoding: utf-8
require "helper"
require "thor/actions"
describe Thor::Actions::InjectIntoFile do
before do
::FileUtils.rm_rf(destination_root)
::FileUtils.cp_r(source_root, destination_root)
end
def invoker(options = {})
@invoker ||= MyCounter.new([1, 2], options, destination_root: destination_ro... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/core_ext/hash_with_indifferent_access_spec.rb | spec/core_ext/hash_with_indifferent_access_spec.rb | require "helper"
require "thor/core_ext/hash_with_indifferent_access"
describe Thor::CoreExt::HashWithIndifferentAccess do
before do
@hash = Thor::CoreExt::HashWithIndifferentAccess.new :foo => "bar", "baz" => "bee", :force => true
end
it "has values accessible by either strings or symbols" do
expect(@h... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/shell/html_spec.rb | spec/shell/html_spec.rb | require "helper"
describe Thor::Shell::HTML do
def shell
@shell ||= Thor::Shell::HTML.new
end
describe "#say" do
it "sets the color if specified" do
out = capture(:stdout) { shell.say "Wow! Now we have colors!", :green }
expect(out.chomp).to eq('<span style="color: green;">Wow! Now we have c... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/shell/color_spec.rb | spec/shell/color_spec.rb | require "helper"
describe Thor::Shell::Color do
def shell
@shell ||= Thor::Shell::Color.new
end
before do
allow($stdout).to receive(:tty?).and_return(true)
allow(ENV).to receive(:[]).and_return(nil)
allow(ENV).to receive(:[]).with("TERM").and_return("ansi")
allow_any_instance_of(StringIO).to... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/shell/basic_spec.rb | spec/shell/basic_spec.rb | # coding: utf-8
require "helper"
describe Thor::Shell::Basic do
def shell
@shell ||= Thor::Shell::Basic.new
end
describe "#padding" do
it "cannot be set to below zero" do
shell.padding = 10
expect(shell.padding).to eq(10)
shell.padding = -1
expect(shell.padding).to eq(0)
end... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/parser/option_spec.rb | spec/parser/option_spec.rb | require "helper"
require "thor/parser"
describe Thor::Option do
def parse(key, value)
Thor::Option.parse(key, value)
end
def option(name, options = {})
@option ||= Thor::Option.new(name, options)
end
describe "#parse" do
describe "with value as a symbol" do
describe "and symbol is a valid... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/parser/argument_spec.rb | spec/parser/argument_spec.rb | require "helper"
require "thor/parser"
describe Thor::Argument do
def argument(name, options = {})
@argument ||= Thor::Argument.new(name, options)
end
describe "errors" do
it "raises an error if name is not supplied" do
expect do
argument(nil)
end.to raise_error(ArgumentError, "Argum... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/parser/arguments_spec.rb | spec/parser/arguments_spec.rb | require "helper"
require "thor/parser"
describe Thor::Arguments do
def create(opts = {})
arguments = opts.map do |type, default|
options = {required: default.nil?, type: type, default: default}
Thor::Argument.new(type.to_s, options)
end
arguments.sort! { |a, b| b.name <=> a.name }
@opt =... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/spec/parser/options_spec.rb | spec/parser/options_spec.rb | require "helper"
require "thor/parser"
describe Thor::Options do
def create(opts, defaults = {}, stop_on_unknown = false, exclusives = [], at_least_ones = [])
relation = {
exclusive_option_names: exclusives,
at_least_one_option_names: at_least_ones
}
opts.each do |key, value|
opts[key] ... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/lib/thor.rb | lib/thor.rb | require_relative "thor/base"
class Thor
$thor_runner ||= false
class << self
# Allows for custom "Command" package naming.
#
# === Parameters
# name<String>
# options<Hash>
#
def package_name(name, _ = {})
@package_name = name.nil? || name == "" ? nil : name
end
# Sets th... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/lib/thor/command.rb | lib/thor/command.rb | class Thor
class Command < Struct.new(:name, :description, :long_description, :wrap_long_description, :usage, :options, :options_relation, :ancestor_name)
FILE_REGEXP = /^#{Regexp.escape(File.dirname(__FILE__))}/
def initialize(name, description, long_description, wrap_long_description, usage, options = nil,... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/lib/thor/actions.rb | lib/thor/actions.rb | require_relative "actions/create_file"
require_relative "actions/create_link"
require_relative "actions/directory"
require_relative "actions/empty_directory"
require_relative "actions/file_manipulation"
require_relative "actions/inject_into_file"
class Thor
module Actions
attr_accessor :behavior
def self.in... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/lib/thor/line_editor.rb | lib/thor/line_editor.rb | require_relative "line_editor/basic"
require_relative "line_editor/readline"
class Thor
module LineEditor
def self.readline(prompt, options = {})
best_available.new(prompt, options).readline
end
def self.best_available
[
Thor::LineEditor::Readline,
Thor::LineEditor::Basic
... | ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
rails/thor | https://github.com/rails/thor/blob/b2d98fea78fd993b936fc434a3ad722e73ad6bc5/lib/thor/version.rb | lib/thor/version.rb | class Thor
VERSION = "1.4.0"
end
| ruby | MIT | b2d98fea78fd993b936fc434a3ad722e73ad6bc5 | 2026-01-04T15:43:28.376179Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.