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
httprb/http
https://github.com/httprb/http/blob/7a32573d61477ab45af321f40e05039c6301c2f6/lib/http/headers/mixin.rb
lib/http/headers/mixin.rb
# frozen_string_literal: true require "forwardable" module HTTP class Headers # Provides shared behavior for {HTTP::Request} and {HTTP::Response}. # Expects `@headers` to be an instance of {HTTP::Headers}. # # @example Usage # # class MyHttpRequest # include HTTP::Headers::Mixin ...
ruby
MIT
7a32573d61477ab45af321f40e05039c6301c2f6
2026-01-04T15:51:40.084926Z
false
httprb/http
https://github.com/httprb/http/blob/7a32573d61477ab45af321f40e05039c6301c2f6/lib/http/headers/normalizer.rb
lib/http/headers/normalizer.rb
# frozen_string_literal: true module HTTP class Headers class Normalizer # Matches HTTP header names when in "Canonical-Http-Format" CANONICAL_NAME_RE = /\A[A-Z][a-z]*(?:-[A-Z][a-z]*)*\z/ # Matches valid header field name according to RFC. # @see http://tools.ietf.org/html/rfc7230#sectio...
ruby
MIT
7a32573d61477ab45af321f40e05039c6301c2f6
2026-01-04T15:51:40.084926Z
false
httprb/http
https://github.com/httprb/http/blob/7a32573d61477ab45af321f40e05039c6301c2f6/lib/http/headers/known.rb
lib/http/headers/known.rb
# frozen_string_literal: true module HTTP class Headers # Content-Types that are acceptable for the response. ACCEPT = "Accept" # Content-codings that are acceptable in the response. ACCEPT_ENCODING = "Accept-Encoding" # The age the object has been in a proxy cache in seconds. AGE = "Age" ...
ruby
MIT
7a32573d61477ab45af321f40e05039c6301c2f6
2026-01-04T15:51:40.084926Z
false
httprb/http
https://github.com/httprb/http/blob/7a32573d61477ab45af321f40e05039c6301c2f6/lib/http/mime_type/adapter.rb
lib/http/mime_type/adapter.rb
# frozen_string_literal: true require "forwardable" require "singleton" module HTTP module MimeType # Base encode/decode MIME type adapter class Adapter include Singleton class << self extend Forwardable def_delegators :instance, :encode, :decode end # rubocop:disab...
ruby
MIT
7a32573d61477ab45af321f40e05039c6301c2f6
2026-01-04T15:51:40.084926Z
false
httprb/http
https://github.com/httprb/http/blob/7a32573d61477ab45af321f40e05039c6301c2f6/lib/http/mime_type/json.rb
lib/http/mime_type/json.rb
# frozen_string_literal: true require "json" require "http/mime_type/adapter" module HTTP module MimeType # JSON encode/decode MIME type adapter class JSON < Adapter # Encodes object to JSON def encode(obj) return obj.to_json if obj.respond_to?(:to_json) ::JSON.dump obj en...
ruby
MIT
7a32573d61477ab45af321f40e05039c6301c2f6
2026-01-04T15:51:40.084926Z
false
httprb/http
https://github.com/httprb/http/blob/7a32573d61477ab45af321f40e05039c6301c2f6/lib/http/response/parser.rb
lib/http/response/parser.rb
# frozen_string_literal: true require "llhttp" module HTTP class Response # @api private class Parser attr_reader :parser, :headers, :status_code, :http_version def initialize @handler = Handler.new(self) @parser = LLHttp::Parser.new(@handler, type: :response) reset ...
ruby
MIT
7a32573d61477ab45af321f40e05039c6301c2f6
2026-01-04T15:51:40.084926Z
false
httprb/http
https://github.com/httprb/http/blob/7a32573d61477ab45af321f40e05039c6301c2f6/lib/http/response/inflater.rb
lib/http/response/inflater.rb
# frozen_string_literal: true require "zlib" module HTTP class Response class Inflater attr_reader :connection def initialize(connection) @connection = connection end def readpartial(*args) chunk = @connection.readpartial(*args) if chunk chunk = zstrea...
ruby
MIT
7a32573d61477ab45af321f40e05039c6301c2f6
2026-01-04T15:51:40.084926Z
false
httprb/http
https://github.com/httprb/http/blob/7a32573d61477ab45af321f40e05039c6301c2f6/lib/http/response/body.rb
lib/http/response/body.rb
# frozen_string_literal: true require "forwardable" require "http/client" module HTTP class Response # A streamable response body, also easily converted into a string class Body extend Forwardable include Enumerable def_delegator :to_s, :empty? # The connection object used to make t...
ruby
MIT
7a32573d61477ab45af321f40e05039c6301c2f6
2026-01-04T15:51:40.084926Z
false
httprb/http
https://github.com/httprb/http/blob/7a32573d61477ab45af321f40e05039c6301c2f6/lib/http/response/status.rb
lib/http/response/status.rb
# frozen_string_literal: true require "delegate" require "http/response/status/reasons" module HTTP class Response class Status < ::Delegator class << self # Coerces given value to Status. # # @example # # Status.coerce(:bad_request) # => Status.new(400) ...
ruby
MIT
7a32573d61477ab45af321f40e05039c6301c2f6
2026-01-04T15:51:40.084926Z
false
httprb/http
https://github.com/httprb/http/blob/7a32573d61477ab45af321f40e05039c6301c2f6/lib/http/response/status/reasons.rb
lib/http/response/status/reasons.rb
# frozen_string_literal: true # AUTO-GENERATED FILE, DO NOT CHANGE IT MANUALLY require "delegate" module HTTP class Response class Status < ::Delegator # Code to Reason map # # @example Usage # # REASONS[400] # => "Bad Request" # REASONS[414] # => "Request-URI Too Long" ...
ruby
MIT
7a32573d61477ab45af321f40e05039c6301c2f6
2026-01-04T15:51:40.084926Z
false
httprb/http
https://github.com/httprb/http/blob/7a32573d61477ab45af321f40e05039c6301c2f6/lib/http/request/writer.rb
lib/http/request/writer.rb
# frozen_string_literal: true require "http/headers" module HTTP class Request class Writer # CRLF is the universal HTTP delimiter CRLF = "\r\n" # Chunked data termintaor. ZERO = "0" # Chunked transfer encoding CHUNKED = "chunked" # End of a chunked transfer CH...
ruby
MIT
7a32573d61477ab45af321f40e05039c6301c2f6
2026-01-04T15:51:40.084926Z
false
httprb/http
https://github.com/httprb/http/blob/7a32573d61477ab45af321f40e05039c6301c2f6/lib/http/request/body.rb
lib/http/request/body.rb
# frozen_string_literal: true module HTTP class Request class Body attr_reader :source def initialize(source) @source = source validate_source_type! end # Returns size which should be used for the "Content-Length" header. # # @return [Integer] def size...
ruby
MIT
7a32573d61477ab45af321f40e05039c6301c2f6
2026-01-04T15:51:40.084926Z
false
httprb/http
https://github.com/httprb/http/blob/7a32573d61477ab45af321f40e05039c6301c2f6/lib/http/timeout/per_operation.rb
lib/http/timeout/per_operation.rb
# frozen_string_literal: true require "timeout" require "http/timeout/null" module HTTP module Timeout class PerOperation < Null CONNECT_TIMEOUT = 0.25 WRITE_TIMEOUT = 0.25 READ_TIMEOUT = 0.25 def initialize(*args) super @read_timeout = options.fetch(:read_timeout, REA...
ruby
MIT
7a32573d61477ab45af321f40e05039c6301c2f6
2026-01-04T15:51:40.084926Z
false
httprb/http
https://github.com/httprb/http/blob/7a32573d61477ab45af321f40e05039c6301c2f6/lib/http/timeout/null.rb
lib/http/timeout/null.rb
# frozen_string_literal: true require "io/wait" module HTTP module Timeout class Null attr_reader :options, :socket def initialize(options = {}) @options = options end # Connects to a socket def connect(socket_class, host, port, nodelay = false) @socket = socket_c...
ruby
MIT
7a32573d61477ab45af321f40e05039c6301c2f6
2026-01-04T15:51:40.084926Z
false
httprb/http
https://github.com/httprb/http/blob/7a32573d61477ab45af321f40e05039c6301c2f6/lib/http/timeout/global.rb
lib/http/timeout/global.rb
# frozen_string_literal: true require "timeout" require "io/wait" require "http/timeout/null" module HTTP module Timeout class Global < Null def initialize(*args) super @timeout = @time_left = options.fetch(:global_timeout) end # To future me: Don't remove this again, past y...
ruby
MIT
7a32573d61477ab45af321f40e05039c6301c2f6
2026-01-04T15:51:40.084926Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/benchmarks/compile_template_profile.rb
benchmarks/compile_template_profile.rb
$:.unshift 'lib' require "ruby-prof" require 'mustache' require "pathname" template = """ {{#products}} <div class='product_brick'> <div class='container'> <div class='element'> <img src='images/{{image}}' class='product_miniature' /> </div> <div class='element description'> <a...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/benchmarks/render_collection_benchmark.rb
benchmarks/render_collection_benchmark.rb
$:.unshift 'lib' require 'benchmark/ips' require 'mustache' template = """ {{#products}} <div class='product_brick'> <div class='container'> <div class='element'> <img src='images/{{image}}' class='product_miniature' /> </div> <div class='element description'> <a href={{url}} c...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/benchmarks/compile_template_benchmark.rb
benchmarks/compile_template_benchmark.rb
$:.unshift 'lib' require 'benchmark/ips' require 'mustache' template = """ {{#products}} <div class='product_brick'> <div class='container'> <div class='element'> <img src='images/{{image}}' class='product_miniature' /> </div> <div class='element description'> <a href={{url}} c...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/benchmarks/render_collection_profile.rb
benchmarks/render_collection_profile.rb
$:.unshift 'lib' require "ruby-prof" require 'mustache' require "pathname" template = """ {{#products}} <div class='product_brick'> <div class='container'> <div class='element'> <img src='images/{{image}}' class='product_miniature' /> </div> <div class='element description'> <a...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/benchmarks/render_lambda_benchmark.rb
benchmarks/render_lambda_benchmark.rb
$:.unshift "lib" require "mustache" require "benchmark/ips" BASE_TEMPLATE = <<end_of_template <h2>Lambdas</h2> {{#lambdas}} {{#lambda}} Here is some text inside the lambda.\n Also a variable is present: {{name}}. {{/lambda}} {{/lambdas}} end_of_template one_name = [ { name: "Charlie Chaplin", l...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/benchmarks/render_partials_benchmark.rb
benchmarks/render_partials_benchmark.rb
$:.unshift "lib" require "mustache" require "benchmark/ips" BASE_TEMPLATE = <<end_of_template <h2>Names</h2> {{#names}} {{> user}} {{/names}} end_of_template PARTIAL_TEMPLATE = <<end_of_template <strong>{{name}}</strong> end_of_template one_name = [ {name: "Charlie Chaplin"}, ] data_10 = { names: one_name * ...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/benchmarks/html_escape_benchmark.rb
benchmarks/html_escape_benchmark.rb
$:.unshift 'lib' require 'benchmark/ips' require 'mustache' template = """ <div class='product_brick'> <div class='container'> <div class='element'> <img src='images/{{image}}' class='product_miniature' /> </div> <div class='element description'> <a href={{url}} class='product_name block bol...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/benchmarks/render_template_profile.rb
benchmarks/render_template_profile.rb
$:.unshift 'lib' require "ruby-prof" require 'mustache' require "pathname" template = """ {{#products}} <div class='product_brick'> <div class='container'> <div class='element'> <img src='images/{{image}}' class='product_miniature' /> </div> <div class='element description'> <a...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/benchmarks/render_template_benchmark.rb
benchmarks/render_template_benchmark.rb
$:.unshift 'lib' require 'benchmark/ips' require 'mustache' template = """ {{#products}} <div class='product_brick'> <div class='container'> <div class='element'> <img src='images/{{image}}' class='product_miniature' /> </div> <div class='element description'> <a href={{url}} c...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/template_test.rb
test/template_test.rb
require_relative 'helper' class TemplateTest < Minitest::Test def test_compile assert_equal %("foo"), Mustache::Template.new("foo").compile end def test_compile_with_source assert_equal %("bar"), Mustache::Template.new("foo").compile("bar") end def test_token assert_equal [:multi, [:static, "fo...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/spec_test.rb
test/spec_test.rb
require 'mustache' require 'tmpdir' require 'yaml' require 'minitest/autorun' # Calls appropriate method on YAML. See: https://gist.github.com/tenderlove/958999ab4240b93bd3cd YAML.add_domain_type(nil, 'code') { |_, val| eval(val['ruby']) } # A simple base class for Mustache specs. # Creates a partials directory, then...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/parser_test.rb
test/parser_test.rb
require_relative 'helper' class ParserTest < Minitest::Test def test_parser_extension parser = Mustache::Parser.new parser.instance_variable_set :@result, 'zomg' Mustache::Parser.add_type(:'@', :'$') do |*args| [:mustache, :at_sign, @result, *args] end assert_match Mustache::Parser.valid_t...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/partial_test.rb
test/partial_test.rb
require_relative 'helper' class PartialTest < Minitest::Test def test_view_partial assert_equal <<-end_partial.strip, PartialWithModule.render <h1>Welcome</h1> Hello Bob You have just won $100000! <h3>Fair enough, right?</h3> end_partial end def test_partial_with_slashes klass = Class.new(Mustache) ...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/autoloading_test.rb
test/autoloading_test.rb
require_relative 'helper' module TestViews; end class AutoloadingTest < Minitest::Test def setup Mustache.view_path = File.dirname(__FILE__) + '/fixtures' end def test_autoload klass = Mustache.view_class(:Comments) assert_equal Comments, klass end def test_autoload_lowercase klass = Musta...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/mustache_test.rb
test/mustache_test.rb
# -*- coding: utf-8 -*- require_relative 'helper' require 'json' class MustacheTest < Minitest::Test def test_instance_render klass = Class.new(Mustache) klass.template = "Hi {{thing}}!" assert_equal "Hi world!", klass.render(:thing => :world) assert_equal "Nice.", klass.render("{{compliment}}.", :co...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/helper.rb
test/helper.rb
require 'simplecov' SimpleCov.start do add_filter '/test/' end require 'minitest/autorun' Dir[File.dirname(__FILE__) + '/fixtures/*.rb'].each do |f| require f end
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/complex_view.rb
test/fixtures/complex_view.rb
require 'mustache' class ComplexView < Mustache self.path = File.dirname(__FILE__) def header "Colors" end def item items = [] items << { :name => 'red', :current => true, :url => '#Red' } items << { :name => 'green', :current => false, :url => '#Green' } items << { :name => 'blue', :curr...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/comments.rb
test/fixtures/comments.rb
require 'mustache' class Comments < Mustache self.path = File.dirname(__FILE__) def title "A Comedy of Errors" end end if $0 == __FILE__ puts Comments.to_html end
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/dot_notation.rb
test/fixtures/dot_notation.rb
require 'mustache' class DotNotation < Mustache self.path = File.dirname(__FILE__) def person return { :name => OpenStruct.new(:first => 'Chris', :last => 'Firescythe'), :age => 24, :hometown => { :city => "Cincinnati", :state => "OH" } } end def normal "...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/recursive.rb
test/fixtures/recursive.rb
require 'mustache' class Recursive < Mustache self.path = File.dirname(__FILE__) def show false end end if $0 == __FILE__ puts Recursive.to_html end
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/delimiters.rb
test/fixtures/delimiters.rb
require 'mustache' class Delimiters < Mustache self.path = File.dirname(__FILE__) def start "It worked the first time." end def middle [ { :item => "And it worked the second time." }, { :item => "As well as the third." } ] end def final "Then, surprisingly, it worked the final time." ...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/inverted_section.rb
test/fixtures/inverted_section.rb
require 'mustache' class InvertedSection < Mustache self.path = File.dirname(__FILE__) def t false end def two "second" end end
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/namespaced.rb
test/fixtures/namespaced.rb
require 'mustache' module TestViews class Namespaced < Mustache self.path = File.dirname(__FILE__) def title "Dragon < Tiger" end end class NamespacedWithPartial < Mustache self.path = File.dirname(__FILE__) self.template = "My opinion: {{>inner_partial}}" def title "Victor...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/liberal.rb
test/fixtures/liberal.rb
require 'mustache' class Liberal < Mustache self.path = File.dirname(__FILE__) def first_name "kevin" end def middle_name! 'j' end def lastName? 'sheurs' end define_method :'street-address' do '123 Somewhere St' end end if $0 == __FILE__ puts Liberal.to_html end
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/passenger.rb
test/fixtures/passenger.rb
require 'mustache' class Passenger < Mustache self.path = File.dirname(__FILE__) self.template_extension = 'conf' def server "example.com" end def deploy_to "/var/www/example.com" end def stage "production" end def timestamp Time.now.strftime('%Y%m%d%H%M%S') end end if $0 == __...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/simple.rb
test/fixtures/simple.rb
require 'mustache' class Simple < Mustache self.path = File.dirname(__FILE__) def name "Chris" end def value 10_000 end def taxed_value value - (value * 0.4) end def in_ca true end end if $0 == __FILE__ puts Simple.to_html end
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/nested_objects.rb
test/fixtures/nested_objects.rb
require 'mustache' require 'ostruct' class NestedObjects < Mustache self.path = File.dirname(__FILE__) def header "Colors" end def item items = [] items << OpenStruct.new(:name => 'red', :current => true, :url => '#Red') items << OpenStruct.new(:name => 'green', :current => false, :url => '#G...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/unescaped.rb
test/fixtures/unescaped.rb
require 'mustache' class Unescaped < Mustache self.path = File.dirname(__FILE__) def title "Bear > Shark" end end if $0 == __FILE__ puts Unescaped.to_html end
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/escaped.rb
test/fixtures/escaped.rb
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib' require 'mustache' class Escaped < Mustache self.path = File.dirname(__FILE__) def title "Bear > Shark" end end if $0 == __FILE__ puts Escaped.to_html end
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/partial_with_module.rb
test/fixtures/partial_with_module.rb
require 'mustache' module SimpleView def name "Bob" end def value 100_000 end def taxed_value value - (value * 0.4) end def in_ca false end end class PartialWithModule < Mustache include SimpleView self.path = File.dirname(__FILE__) def greeting "Welcome" end def far...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/crazy_recursive.rb
test/fixtures/crazy_recursive.rb
require 'mustache' class CrazyRecursive < Mustache self.path = File.dirname(__FILE__) def top_nodes [{ :contents => "1", :children => [{ :contents => "2", :children => [{ :contents => "3", :children => [] }] }, { :contents => "4", ...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/method_missing.rb
test/fixtures/method_missing.rb
require 'mustache' class MethodMissing < Mustache self.template = '[ {{#list}}{{.}} {{/list}}]' def method_missing(name, *args, &block) return (0..10).to_a if name == :list return super end def respond_to?(method) method == :list end end if $0 == __FILE__ puts MethodMissing.to_html end
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/template_partial.rb
test/fixtures/template_partial.rb
require 'mustache' class TemplatePartial < Mustache self.path = File.dirname(__FILE__) def title "Welcome" end def title_bars '-' * title.size end end if $0 == __FILE__ puts TemplatePartial.to_html end
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/double_section.rb
test/fixtures/double_section.rb
require 'mustache' class DoubleSection < Mustache self.path = File.dirname(__FILE__) def t true end def two "second" end end
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/test/fixtures/lambda.rb
test/fixtures/lambda.rb
require 'mustache' class Lambda < Mustache self.path = File.dirname(__FILE__) attr_reader :calls def initialize(*args) super @calls = 0 @cached = nil end def rendered lambda do |text| return @cached if @cached @calls += 1 @cached = render(text) end end def not_r...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/examples/simple.rb
examples/simple.rb
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib' require 'mustache' class Simple < Mustache self.path = File.dirname(__FILE__) def name "Chris" end def value 10_000 end def taxed_value value - (value * 0.4) end def in_ca true end end puts Simple.render if $0 == __FILE__
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/examples/hash.rb
examples/hash.rb
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib' require 'mustache' Mustache.template_file = File.dirname(__FILE__) + '/simple.mustache' view = Mustache.new print "Your name: " view[:name] = gets view[:value] = value = rand(10_000) print "Are you in CA? [y/n] " if view[:in_ca] = gets.to_s.downcase[0].chr == 'y'...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/examples/i18n/mustache_i18n2.rb
examples/i18n/mustache_i18n2.rb
class Stache18n @@tags = { 'comment-and-close' => 'Comment and close', 'github' => 'GitHub', 'social-coding' => 'Social Coding' } def self.t new end def method_missing(tag) @@tags[tag.to_s] end def respond_to?(tag) @@tags[tag.to_s] end end puts Mustache.render(<<END, Stache18...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/examples/i18n/mustache_i18n.rb
examples/i18n/mustache_i18n.rb
class Stache18n @@tags = { 'comment-and-close' => 'Comment and close', 'github' => 'GitHub', 'social-coding' => 'Social Coding' } def self.t @@tags end end puts Mustache.render(<<END, Stache18n) <title>{{t.github}} - {{t.social-coding}}</title> END
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/lib/mustache.rb
lib/mustache.rb
require 'mustache/enumerable' require 'mustache/template' require 'mustache/context' require 'mustache/settings' require 'mustache/utils' # Mustache is the base class from which your Mustache subclasses # should inherit (though it can be used on its own). # # The typical Mustache workflow is as follows: # # * Create a...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/lib/mustache/version.rb
lib/mustache/version.rb
class Mustache VERSION = '1.1.1' end
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/lib/mustache/context_miss.rb
lib/mustache/context_miss.rb
class Mustache # A ContextMiss is raised whenever a tag's target can not be found # in the current context if `Mustache#raise_on_context_miss?` is # set to true. # # For example, if your View class does not respond to `music` but # your template contains a `{{music}}` tag this exception will be raised. #...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/lib/mustache/utils.rb
lib/mustache/utils.rb
class Mustache module Utils class String def initialize string @string = string end def classify @string.split('/').map do |namespace| namespace.split(/[-_]/).map do |part| part[0] = part.chars.first.upcase part end.join end.jo...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/lib/mustache/parser.rb
lib/mustache/parser.rb
require 'strscan' class Mustache # The Parser is responsible for taking a string template and # converting it into an array of tokens and, really, expressions. It # raises SyntaxError if there is anything it doesn't understand and # knows which sigil corresponds to which tag type. # # For example, given th...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/lib/mustache/settings.rb
lib/mustache/settings.rb
# Settings which can be configured for all view classes, a single # view class, or a single Mustache instance. class Mustache def initialize_settings @template = nil @template_path = nil @template_extension = nil @template_name = nil @template_file = nil @raise_on_context_miss = nil end ...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/lib/mustache/template.rb
lib/mustache/template.rb
require 'cgi' require 'mustache/parser' require 'mustache/generator' class Mustache # A Template represents a Mustache template. It compiles and caches # a raw string template into something usable. # # The idea is this: when handed a Mustache template, convert it into # a Ruby string by transforming Mustac...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/lib/mustache/enumerable.rb
lib/mustache/enumerable.rb
class Mustache Enumerable = Module.new end
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/lib/mustache/generator.rb
lib/mustache/generator.rb
class Mustache # The Generator is in charge of taking an array of Mustache tokens, # usually assembled by the Parser, and generating an interpolatable # Ruby string. This string is considered the "compiled" template # because at that point we're relying on Ruby to do the parsing and # run our code. # # Fo...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
mustache/mustache
https://github.com/mustache/mustache/blob/9fefaabd2b1e68ef8186a210af1f0e18ef48bb55/lib/mustache/context.rb
lib/mustache/context.rb
require 'mustache/context_miss' class Mustache # A Context represents the context which a Mustache template is # executed within. All Mustache tags reference keys in the Context. # class Context # Initializes a Mustache::Context. # # @param [Mustache] mustache A Mustache instance. # def i...
ruby
MIT
9fefaabd2b1e68ef8186a210af1f0e18ef48bb55
2026-01-04T15:51:49.321914Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/benchmarks/permissive_respond_to.rb
benchmarks/permissive_respond_to.rb
#!/usr/bin/env ruby $LOAD_PATH.unshift File.expand_path(File.join('..', 'lib'), __dir__) require 'hashie' require 'benchmark/ips' require 'benchmark/memory' permissive = Class.new(Hashie::Mash) Benchmark.memory do |x| x.report('Default') {} x.report('Make permissive') do permissive.include Hashie::Extension...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/benchmarks/keep_original_mash_keys.rb
benchmarks/keep_original_mash_keys.rb
require_relative '../lib/hashie' require 'benchmark/ips' class KeepingMash < Hashie::Mash include Hashie::Extensions::Mash::KeepOriginalKeys end original = { test: 'value' } mash = Hashie::Mash.new(original) keeping_mash = KeepingMash.new(original) Benchmark.ips do |x| x.report('keep symbol') { keeping_mash.test...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/benchmarks/mash_method_access.rb
benchmarks/mash_method_access.rb
$LOAD_PATH.unshift('lib') require 'hashie' require 'benchmark/ips' mash = Hashie::Mash.new(test: 'value') Benchmark.ips do |x| x.hold!('tmp/mash_benchmark.json') x.report('before') { mash.test } x.report('after') { mash.test } x.compare! end
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie_spec.rb
spec/hashie_spec.rb
require 'spec_helper' RSpec.describe Hashie do describe '.logger' do include_context 'with a logger' it 'is available via an accessor' do Hashie.logger.info('Fee fi fo fum') expect(logger_output).to match('Fee fi fo fum') end end end
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/spec_helper.rb
spec/spec_helper.rb
if ENV['CI'] require 'simplecov' SimpleCov.start end require 'pry' require 'rspec' require 'hashie' require 'json' require 'rspec/pending_for' require './spec/support/ruby_version_check' require './spec/support/logger' require './spec/support/matchers' Dir[File.expand_path(File.join(__dir__, 'support', '**', '*'...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/support/matchers.rb
spec/support/matchers.rb
RSpec::Matchers.define :parse_as_valid_ruby do require 'ripper' match do |actual| parsed = Ripper.sexp(actual) !parsed.nil? end failure_message do |actual| "expected that #{actual} would parse as valid Ruby" end end
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/support/module_context.rb
spec/support/module_context.rb
shared_context 'included hash module' do let!(:dummy_class) do klass = Class.new(::Hash) klass.send :include, described_class klass end subject do dummy_class.new end end
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/support/logger.rb
spec/support/logger.rb
# A shared context that allows you to check the output of Hashie's logger. # # @example # include_context 'with a logger' # # it 'logs info message' do # Hashie.logger.info 'What is happening in here?!' # # expect(logger_output).to match('What is happening in here?!') # end RSpec.shared_context 'with a lo...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/support/shared_examples.rb
spec/support/shared_examples.rb
RSpec.shared_examples 'Dash default handling' do |property, name = property| it 'uses the default when initializing' do expect(test.new(name => nil).public_send(property)).to eq '' end it 'allows you to set the value to nil with the hash writer' do trash = test.new(name => 'foo') trash[name] = nil ...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/support/ruby_version_check.rb
spec/support/ruby_version_check.rb
module RubyVersionCheck def with_minimum_ruby(version) yield if Hashie::Extensions::RubyVersion.new(RUBY_VERSION) >= Hashie::Extensions::RubyVersion.new(version) end end
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/support/integration_specs.rb
spec/support/integration_specs.rb
require File.expand_path('../../../lib/hashie/extensions/ruby_version', __FILE__) # Generates the bundle command for running an integration test # # @param [String] integration the integration folder to run # @param [String] command the command to run # @return [String] def integration_command(integration, command) ...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/integration/rails/integration_spec.rb
spec/integration/rails/integration_spec.rb
ENV['RAILS_ENV'] = 'test' require 'logger' # https://github.com/rails/rails/issues/54260 require 'rspec/core' RSpec.describe 'rails', type: :request do let(:stdout) { StringIO.new } around(:each) do |example| original_stdout = $stdout $stdout = stdout require_relative 'app' require 'rspec/rails' ...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/integration/rails/app.rb
spec/integration/rails/app.rb
require 'action_controller/railtie' require 'action_view/railtie' require 'action_view/testing/resolvers' require 'rails/test_unit/railtie' module RailsApp class Application < ::Rails::Application config.eager_load = false config.secret_key_base = 'hashieintegrationtest' routes.append do get ...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/integration/active_support/integration_spec.rb
spec/integration/active_support/integration_spec.rb
require 'active_support' require 'active_support/core_ext' require 'active_support/core_ext/hash/indifferent_access' require 'active_support/core_ext/hash' require 'hashie' RSpec.configure do |config| config.expect_with :rspec do |expect| expect.syntax = :expect end end RSpec.describe Hashie::Mash do descri...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/integration/rails-without-dependency/integration_spec.rb
spec/integration/rails-without-dependency/integration_spec.rb
require 'rspec/core' RSpec.describe 'partial-rails' do context 'when Rails constant is present but the railties are not' do before(:all) do class Rails # A class about railways end end it 'does not raise an exception when we require hashie' do expect { require 'hashie' }.not_to...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/integration/elasticsearch/integration_spec.rb
spec/integration/elasticsearch/integration_spec.rb
require 'elasticsearch/model' require 'hashie' RSpec.configure do |config| config.expect_with :rspec do |expect| expect.syntax = :expect end end class MyModel < Hashie::Mash include Elasticsearch::Model disable_warnings index_name 'model' document_type 'model' def as_indexed_json(options = {}) ...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/integration/rails_7/integration_spec.rb
spec/integration/rails_7/integration_spec.rb
ENV['RAILS_ENV'] = 'test' require 'logger' # https://github.com/rails/rails/issues/54260 require 'rspec/core' RSpec.describe 'rails', type: :request do let(:stdout) { StringIO.new } around(:each) do |example| original_stdout = $stdout $stdout = stdout require_relative 'app' require 'rspec/rails' ...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/integration/rails_7/app.rb
spec/integration/rails_7/app.rb
require 'action_controller/railtie' require 'action_view/railtie' require 'action_view/testing/resolvers' require 'rails/test_unit/railtie' module RailsApp class Application < ::Rails::Application config.eager_load = false config.secret_key_base = 'hashieintegrationtest' routes.append do get ...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/integration/omniauth-oauth2/integration_spec.rb
spec/integration/omniauth-oauth2/integration_spec.rb
ENV['RAILS_ENV'] = 'test' require 'rspec/core' RSpec.describe 'omniauth-oauth2 inside of rails', type: :request do let(:stdout) { StringIO.new } around(:each) do |example| original_stdout = $stdout $stdout = stdout require_relative 'app' require 'rspec/rails' example.run $stdout = origina...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/integration/omniauth-oauth2/app.rb
spec/integration/omniauth-oauth2/app.rb
require 'action_controller/railtie' require 'action_view/railtie' require 'action_view/testing/resolvers' require 'rails/test_unit/railtie' require_relative 'some_site' module RailsApp class Application < ::Rails::Application config.eager_load = false config.secret_key_base = 'hashieintegrationtest' ...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/integration/omniauth-oauth2/some_site.rb
spec/integration/omniauth-oauth2/some_site.rb
require 'omniauth-oauth2' module OmniAuth module Strategies class SomeSite < OmniAuth::Strategies::OAuth2 # Give your strategy a name. option :name, 'some_site' # This is where you pass the options you would pass when # initializing your consumer from the OAuth gem. option :client_...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/integration/omniauth/integration_spec.rb
spec/integration/omniauth/integration_spec.rb
ENV['RACK_ENV'] = 'test' require 'rspec/core' require 'rack/test' RSpec.configure do |config| config.expect_with :rspec do |expect| expect.syntax = :expect end end RSpec.describe 'omniauth' do include Rack::Test::Methods def app MyApplication end let(:stdout) { StringIO.new } around(:each) d...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/integration/omniauth/app.rb
spec/integration/omniauth/app.rb
require 'sinatra' require 'omniauth' require 'securerandom' class MyApplication < Sinatra::Base use Rack::Session::Cookie, secret: SecureRandom.hex(64) use OmniAuth::Strategies::Developer get '/' do 'Hello World' end end
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/clash_spec.rb
spec/hashie/clash_spec.rb
require 'spec_helper' describe Hashie::Clash do it 'is able to set an attribute via method_missing' do subject.foo('bar') expect(subject[:foo]).to eq 'bar' end it 'is able to set multiple attributes' do subject.foo('bar').baz('wok') expect(subject).to eq(foo: 'bar', baz: 'wok') end it 'conv...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/version_spec.rb
spec/hashie/version_spec.rb
require 'spec_helper' describe Hashie do it 'has a version' do expect(Hashie::VERSION).not_to be_nil end end
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/trash_spec.rb
spec/hashie/trash_spec.rb
require 'spec_helper' describe Hashie::Trash do class TrashTest < Hashie::Trash property :first_name, from: :firstName end let(:trash) { TrashTest.new } describe 'translating properties' do it 'adds the property to the list' do expect(TrashTest.properties).to include(:first_name) end i...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/mash_spec.rb
spec/hashie/mash_spec.rb
require 'spec_helper' describe Hashie::Mash do subject { Hashie::Mash.new } include_context 'with a logger' it 'inherits from Hash' do expect(subject.is_a?(Hash)).to be_truthy end it 'sets hash values through method= calls' do subject.test = 'abc' expect(subject['test']).to eq 'abc' end i...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
true
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/array_spec.rb
spec/hashie/array_spec.rb
require 'spec_helper' describe Array do describe '#dig' do let(:array) { Hashie::Array.new(%i[a b c]) } it 'works with a string index' do expect(array.dig('0')).to eq(:a) end it 'works with a numeric index' do expect(array.dig(1)).to eq(:b) end context 'when array is empty' do ...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/utils_spec.rb
spec/hashie/utils_spec.rb
require 'spec_helper' def a_method_to_match_against 'Hello world!' end RSpec.describe Hashie::Utils do describe '.method_information' do it 'states the module or class that a native method was defined in' do bound_method = method(:object_id) message = Hashie::Utils.method_information(bound_method...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/hash_spec.rb
spec/hashie/hash_spec.rb
require 'spec_helper' describe Hash do it 'is convertible to a Hashie::Mash' do mash = Hashie::Hash[some: 'hash'].to_mash expect(mash.is_a?(Hashie::Mash)).to be_truthy expect(mash.some).to eq 'hash' end it '#stringify_keys! turns all keys into strings' do hash = Hashie::Hash[a: 'hey', 123 => 'bo...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/dash_spec.rb
spec/hashie/dash_spec.rb
require 'spec_helper' Hashie::Hash.class_eval do def self.inherited(klass) klass.instance_variable_set('@inheritance_test', true) end end class DashTest < Hashie::Dash property :first_name, required: true property :email property :count, default: 0 end class DashTestDefaultProc < Hashie::Dash propert...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/rash_spec.rb
spec/hashie/rash_spec.rb
require 'spec_helper' describe Hashie::Rash do subject do Hashie::Rash.new( /hello/ => 'hello', /world/ => 'world', 'other' => 'whee', true => false, 1 => 'awesome', 1..1000 => 'rangey', /(bcd)/ => proc { |m| m[1] } # /.+/ => "EVERYTHING" ) end it...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/key_conversion_spec.rb
spec/hashie/extensions/key_conversion_spec.rb
require 'spec_helper' require 'support/module_context' describe Hashie::Extensions::KeyConversion do include_context 'included hash module' it { should respond_to(:stringify_keys) } it { should respond_to(:stringify_keys!) } it { should respond_to(:symbolize_keys) } it { should respond_to(:symbolize_keys!)...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/strict_key_access_spec.rb
spec/hashie/extensions/strict_key_access_spec.rb
require 'spec_helper' describe Hashie::Extensions::StrictKeyAccess do class StrictKeyAccessHash < Hash include Hashie::Extensions::StrictKeyAccess end shared_examples_for 'StrictKeyAccess with valid key' do |options = {}| before { pending_for(options[:pending]) } if options[:pending] context 'set' d...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/deep_locate_spec.rb
spec/hashie/extensions/deep_locate_spec.rb
require 'spec_helper' describe Hashie::Extensions::DeepLocate do let(:hash) do { from: 0, size: 25, query: { bool: { must: [ { query_string: { query: 'foobar', default_operator: 'AND', fields: [ ...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false
hashie/hashie
https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/method_access_spec.rb
spec/hashie/extensions/method_access_spec.rb
require 'spec_helper' describe Hashie::Extensions::MethodReader do class ReaderHash < Hash include Hashie::Extensions::MethodReader def initialize(hash = {}) update(hash) end end subject { ReaderHash } it 'reads string keys from the method' do expect(subject.new('awesome' => 'sauce').a...
ruby
MIT
2be306fd903bce762cda8e25feb07f172099ef11
2026-01-04T15:51:50.326133Z
false