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 |
|---|---|---|---|---|---|---|---|---|
ruby-grape/grape-active_model_serializers | https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/lib/grape-active_model_serializers/error_formatter.rb | lib/grape-active_model_serializers/error_formatter.rb | module Grape
module ErrorFormatter
class ActiveModelSerializers < Base
class << self
def call(message, backtrace, options = {}, env = nil, original_exception = nil)
message = present(message, env) if respond_to?(:present)
message = wrap_message(message)
rescue_options ... | ruby | MIT | c985c86410eecbdb38c5f4a08c8e01344d67d2b5 | 2026-01-04T17:41:05.144005Z | false |
ruby-grape/grape-active_model_serializers | https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/lib/grape-active_model_serializers/formatter.rb | lib/grape-active_model_serializers/formatter.rb | module Grape
module Formatter
class ActiveModelSerializers
class << self
def call(resource, env)
options = build_options(resource, env)
serializer = fetch_serializer(resource, options)
if serializer
::ActiveModelSerializers::Adapter.create(
se... | ruby | MIT | c985c86410eecbdb38c5f4a08c8e01344d67d2b5 | 2026-01-04T17:41:05.144005Z | false |
ruby-grape/grape-active_model_serializers | https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/lib/grape-active_model_serializers/options_builder.rb | lib/grape-active_model_serializers/options_builder.rb | module Grape
module ActiveModelSerializers
class OptionsBuilder
def initialize(resource, env)
self.resource = resource
self.env = env
end
def options
@options ||= begin
options = endpoint_options
options[:scope] = endpoint unless options.key?(:scope)
... | ruby | MIT | c985c86410eecbdb38c5f4a08c8e01344d67d2b5 | 2026-01-04T17:41:05.144005Z | false |
ruby-grape/grape-active_model_serializers | https://github.com/ruby-grape/grape-active_model_serializers/blob/c985c86410eecbdb38c5f4a08c8e01344d67d2b5/lib/grape-active_model_serializers/serializer_resolver.rb | lib/grape-active_model_serializers/serializer_resolver.rb | module Grape
module ActiveModelSerializers
class SerializerResolver
def initialize(resource, options)
self.resource = resource
self.options = options
end
def serializer
serializer_class&.new(resource, serializer_options)
end
private
attr_accessor :res... | ruby | MIT | c985c86410eecbdb38c5f4a08c8e01344d67d2b5 | 2026-01-04T17:41:05.144005Z | false |
AndyObtiva/super_module | https://github.com/AndyObtiva/super_module/blob/2152357b6520b080a0816ee035d155df83390815/spec/spec_helper.rb | spec/spec_helper.rb | ENV['APP_ENV'] = 'test'
ENV['CODECLIMATE_REPO_TOKEN'] = '0e64c46d3240d588d5bf60ac103b36c03ce382a879612b914404fa973f309d97'
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :test)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
... | ruby | MIT | 2152357b6520b080a0816ee035d155df83390815 | 2026-01-04T17:41:06.351043Z | false |
AndyObtiva/super_module | https://github.com/AndyObtiva/super_module/blob/2152357b6520b080a0816ee035d155df83390815/spec/support/v1.rb | spec/support/v1.rb | module V1
end
require File.join(File.dirname(__FILE__), 'v1', 'fake_active_model')
require File.join(File.dirname(__FILE__), 'v1', 'foo')
require File.join(File.dirname(__FILE__), 'v1', 'bar')
require File.join(File.dirname(__FILE__), 'v1', 'baz')
| ruby | MIT | 2152357b6520b080a0816ee035d155df83390815 | 2026-01-04T17:41:06.351043Z | false |
AndyObtiva/super_module | https://github.com/AndyObtiva/super_module/blob/2152357b6520b080a0816ee035d155df83390815/spec/support/v1/foo.rb | spec/support/v1/foo.rb | module V1::Foo
include SuperModule
include ::V1::FakeActiveModel
validates 'foo', {:presence => true}
class << self
def foo_class_self
'self.foo_class_self'
end
def foo_class_self_define_method; 'self.foo_class_self_define_method'; end
def foo_private_declaration_follow_up
'self.f... | ruby | MIT | 2152357b6520b080a0816ee035d155df83390815 | 2026-01-04T17:41:06.351043Z | false |
AndyObtiva/super_module | https://github.com/AndyObtiva/super_module/blob/2152357b6520b080a0816ee035d155df83390815/spec/support/v1/fake_active_model.rb | spec/support/v1/fake_active_model.rb | # Uses CRLF for line breaks to provide a test case for having SuperModule work with it
# This is done to test support for Windows Ruby files, which usually use CRLF for line breaks
module V1::FakeActiveModel
include SuperModule
# Test default options specified
def self.validates(attribute, options = {})
val... | ruby | MIT | 2152357b6520b080a0816ee035d155df83390815 | 2026-01-04T17:41:06.351043Z | false |
AndyObtiva/super_module | https://github.com/AndyObtiva/super_module/blob/2152357b6520b080a0816ee035d155df83390815/spec/support/v1/baz.rb | spec/support/v1/baz.rb | module V1::Baz
include SuperModule
include ::V1::Bar
make_barrable
validates 'baz', {:presence => true}
attr_reader :baz_factor
class << self
def baz
'self.baz'
end
end
def initialize(baz_factor)
super()
@baz_factor = baz_factor
end
def baz
'baz'
end
def <=>(other)
... | ruby | MIT | 2152357b6520b080a0816ee035d155df83390815 | 2026-01-04T17:41:06.351043Z | false |
AndyObtiva/super_module | https://github.com/AndyObtiva/super_module/blob/2152357b6520b080a0816ee035d155df83390815/spec/support/v1/bar.rb | spec/support/v1/bar.rb | require 'forwardable'
module V1::Bar
include SuperModule
include ::V1::Foo
include Comparable
validates 'bar', {:presence => true}
attr_reader :created_at
# Defines singleton methods via class << self to provide as a test case for SuperModule
class << self
include Forwardable
def barrable
... | ruby | MIT | 2152357b6520b080a0816ee035d155df83390815 | 2026-01-04T17:41:06.351043Z | false |
AndyObtiva/super_module | https://github.com/AndyObtiva/super_module/blob/2152357b6520b080a0816ee035d155df83390815/spec/lib/super_module_spec.rb | spec/lib/super_module_spec.rb | require 'spec_helper'
class V1::FakeActiveRecord
include ::V1::FakeActiveModel
end
class V1::FooActiveRecord < V1::FakeActiveRecord
include ::V1::Foo
end
class V1::BarActiveRecord < V1::FakeActiveRecord
include ::V1::Bar
end
class V1::BazActiveRecord < V1::FakeActiveRecord
include ::V1::Baz
end
module V1::... | ruby | MIT | 2152357b6520b080a0816ee035d155df83390815 | 2026-01-04T17:41:06.351043Z | false |
AndyObtiva/super_module | https://github.com/AndyObtiva/super_module/blob/2152357b6520b080a0816ee035d155df83390815/lib/super_module.rb | lib/super_module.rb | # SuperModule allows defining class methods and method invocations the same way a super class does without using def included(base).
#
# Author:: Andy Maleh
# Copyright:: Copyright (c) 2014-2024 Andy Maleh
# License:: MIT License
# This module allows defining class methods and method invocations the same way a su... | ruby | MIT | 2152357b6520b080a0816ee035d155df83390815 | 2026-01-04T17:41:06.351043Z | false |
AndyObtiva/super_module | https://github.com/AndyObtiva/super_module/blob/2152357b6520b080a0816ee035d155df83390815/lib/super_module/v1.rb | lib/super_module/v1.rb | require File.expand_path(File.join(File.dirname(__FILE__), 'v1', 'module_body_method_call_recorder'))
require File.expand_path(File.join(File.dirname(__FILE__), 'v1', 'singleton_method_definition_store'))
module SuperModule
module V1
class << self
def included(original_base)
# TODO maybe avoid clas... | ruby | MIT | 2152357b6520b080a0816ee035d155df83390815 | 2026-01-04T17:41:06.351043Z | false |
AndyObtiva/super_module | https://github.com/AndyObtiva/super_module/blob/2152357b6520b080a0816ee035d155df83390815/lib/super_module/v1/singleton_method_definition_store.rb | lib/super_module/v1/singleton_method_definition_store.rb | require 'method_source'
require File.expand_path(File.join(File.dirname(__FILE__), 'module_body_method_call_recorder')) # backwards compatible with Ruby 1.8.7
module SuperModule
module V1
module SingletonMethodDefinitionStore
# excluded list of singleton methods to define (perhaps give a better name)
... | ruby | MIT | 2152357b6520b080a0816ee035d155df83390815 | 2026-01-04T17:41:06.351043Z | false |
AndyObtiva/super_module | https://github.com/AndyObtiva/super_module/blob/2152357b6520b080a0816ee035d155df83390815/lib/super_module/v1/module_body_method_call_recorder.rb | lib/super_module/v1/module_body_method_call_recorder.rb | module SuperModule
module V1
module ModuleBodyMethodCallRecorder
def __super_module_singleton_methods_excluded_from_call_recording
@__super_module_singleton_methods_excluded_from_call_recording ||= [
:__record_method_call,
:__method_signature,
:__inside_super_module_inc... | ruby | MIT | 2152357b6520b080a0816ee035d155df83390815 | 2026-01-04T17:41:06.351043Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/response_spec.rb | spec/response_spec.rb | require "spec_helper"
require "hypernova/response"
describe Hypernova::Response do
describe "#parsed_body" do
let(:body) { { beams: 5 }.to_json }
let(:request) { double("request", body: body) }
let(:response) { described_class.new(request) }
context "when there are no plugins" do
it "parses th... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/plugin_helper_spec.rb | spec/plugin_helper_spec.rb | require "spec_helper"
require "hypernova/plugin_helper"
describe Hypernova::PluginHelper do
class TestClass
include Hypernova::PluginHelper
end
describe "#get_view_data" do
it "reduces the properties" do
class Plugin
def get_view_data(name, data)
data.merge({
blade: "... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/controller_helpers_spec.rb | spec/controller_helpers_spec.rb | require 'spec_helper'
describe Hypernova::ControllerHelpers do
let :controller do
Helpers::Controller.new
end
let :full_controller do
ctlr = Helpers::ControllerWithService.new
ctlr.send(:hypernova_batch_before)
ctlr
end
let :request_data do
{
:test => 1,
:what => 'what?'
... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/request_spec.rb | spec/request_spec.rb | require "spec_helper"
require "hypernova/request"
describe Hypernova::Request do
describe "#body" do
let(:body) { { dead_orcs: 300 } }
let(:jobs) { double("jobs") }
let(:payload) do
{
body: jobs,
idempotent: true,
request_format: :json,
response_format: :json,
... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/batch_url_builder_spec.rb | spec/batch_url_builder_spec.rb | require "spec_helper"
require "hypernova/batch_url_builder"
describe Hypernova::BatchUrlBuilder do
describe ".base_url" do
let(:host) { "mordor.com" }
let(:port) { 1337 }
context "when Hypernova configured scheme to be :https" do
it "returns an https URL" do
Hypernova.configure do |config|... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/parsed_response_spec.rb | spec/parsed_response_spec.rb | require "spec_helper"
require "hypernova/parsed_response"
describe Hypernova::ParsedResponse do
describe "#body" do
it "calls parsed_body on the response" do
jobs = double("jobs")
parsed_body = double("parsed_body")
request = double("request")
response = double("response", parsed_body: pa... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/configuration_spec.rb | spec/configuration_spec.rb | require "spec_helper"
RSpec.describe Hypernova::Configuration do
describe "#initialize" do
it "sets default attributes" do
configuration = described_class.new
expect(configuration.open_timeout).to eq(0.1)
expect(configuration.scheme).to eq(:http)
expect(configuration.timeout).to eq(0.6)
... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/faraday_connection_spec.rb | spec/faraday_connection_spec.rb | require "spec_helper"
require "hypernova/faraday_connection"
describe Hypernova::FaradayConnection do
describe ".build" do
it "instantiates a Faraday object" do
http_adapter = Faraday.default_adapter
Hypernova.configure do |config|
config.http_adapter = http_adapter
end
expect(F... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/mystique_ruby_spec.rb | spec/mystique_ruby_spec.rb | require "spec_helper"
describe Hypernova do
describe ".configure" do
it "configures Hypernova" do
described_class.configure do |config|
config.http_adapter = "http_adapter"
end
expect(described_class.configuration.http_adapter).to eq("http_adapter")
end
end
describe :render_tok... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/http_client_request_spec.rb | spec/http_client_request_spec.rb | require "spec_helper"
require "hypernova/http_client_request"
describe Hypernova::HttpClientRequest do
describe ".post" do
let(:payload) { { spear: :aeglos } }
context "when client's post method requires 1 argument" do
it "calls post on the client" do
class TestClient
def post(url, p... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/request_service_spec.rb | spec/request_service_spec.rb | require "spec_helper"
require "hypernova/request_service"
describe Hypernova::RequestService do
let(:request_service) { described_class.new }
describe "#render_batch" do
context "when jobs are not empty" do
# You may override these variables
let(:body) do
{
"0" => Helpers.job_suc... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/batch_renderer_spec.rb | spec/batch_renderer_spec.rb | require "spec_helper"
require "hypernova/batch_renderer"
require "securerandom"
describe Hypernova::BatchRenderer do
# Do not override these variables
let(:a_html) { "Here is a!" }
let(:c_html) { "Here is c!" }
let(:jobs) do
{
"a" => Helpers.args_1,
"b" => Helpers.args_2,
"c" => Helpers.a... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/blank_renderer_spec.rb | spec/blank_renderer_spec.rb | require "spec_helper"
require "hypernova/blank_renderer"
describe Hypernova::BlankRenderer do
describe "#render" do
let(:job) do
{
data: {
bombs: 2,
missiles: 3,
},
name: "tie fighter",
}
end
it "renders blank html" do
allow(SecureRandom).to ... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/faraday_request_spec.rb | spec/faraday_request_spec.rb | require "spec_helper"
require "hypernova/faraday_request"
describe Hypernova::FaradayRequest do
describe ".post" do
it "uses Faraday to make a POST request" do
Hypernova.configure do |config|
config.host = "arnor.com"
config.port = 80
end
payload = { body: { sword: :narsil } }
... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/batch_spec.rb | spec/batch_spec.rb | require 'spec_helper'
RSpec.describe Hypernova::Batch do
let :service do
Helpers::TokenIdentityService.new
end
let :batch do
Hypernova::Batch.new(service)
end
describe :render do
it "returns a token" do
expect(batch.render(Helpers.args_1)).not_to be_nil
end
it "returns a new token... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/spec_helper.rb | spec/spec_helper.rb | # Requiring SimpleCov and its configuration at the top is important.
# If we do not do this, coverage will only look in the spec/ folder.
require "simplecov"
SimpleCov.minimum_coverage(100)
SimpleCov.start do
add_filter "lib/hypernova/rails/action_controller.rb"
add_filter "spec"
end
require "hypernova"
require "... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/spec/plugins/development_mode_plugin_spec.rb | spec/plugins/development_mode_plugin_spec.rb | require "spec_helper"
require "hypernova/plugins/development_mode_plugin"
describe DevelopmentModePlugin do
describe "#after_response" do
let(:name1) { "Melkor.jsx" }
let(:name2) { "Noldor.jsx" }
let(:name3) { "Valar.jsx" }
let(:result1) { Helpers.job_failure_fallback(500) }
let(:result2) { Helpe... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova.rb | lib/hypernova.rb | require "hypernova/batch"
require "hypernova/configuration"
require "hypernova/rails/action_controller"
require "hypernova/version"
warn "[DEPRECATION] The 'hypernova' gem has been deprecated."
module Hypernova
# thrown by ControllerHelper methods if you don't call hypernova_batch_before first
class NilBatchError... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/request_service.rb | lib/hypernova/request_service.rb | require "hypernova/batch_renderer"
require "hypernova/parsed_response"
require "hypernova/plugin_helper"
class Hypernova::RequestService
include Hypernova::PluginHelper
def render_batch(jobs)
return render_batch_blank(jobs) if jobs.empty?
response_body = Hypernova::ParsedResponse.new(jobs).body
respon... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/batch.rb | lib/hypernova/batch.rb | require 'forwardable'
module Hypernova
class Batch
extend Forwardable
attr_accessor :service
attr_reader :jobs
def_delegators :jobs, :empty?
##
# @param service the Hypernova backend service to use for render_react_batch
# The only requirement for the `service` object is the method ren... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/batch_renderer.rb | lib/hypernova/batch_renderer.rb | require "hypernova/blank_renderer"
require "hypernova/plugin_helper"
class Hypernova::BatchRenderer
include Hypernova::PluginHelper
def initialize(jobs)
@jobs = jobs
end
# Sample response argument:
# {
# "DeathStarLaserComponent.js" => {
# "duration" => 17,
# "error" => nil,
# "ht... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/version.rb | lib/hypernova/version.rb | module Hypernova
VERSION = "2.0.0"
end
| ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/faraday_request.rb | lib/hypernova/faraday_request.rb | require "hypernova/faraday_connection"
class Hypernova::FaradayRequest
def self.post(payload)
Hypernova::FaradayConnection.build.post do |request|
request.url(Hypernova::BatchUrlBuilder.path)
request.headers["Content-Type"] = "application/json"
request.body = payload[:body].to_json
end
en... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/blank_renderer.rb | lib/hypernova/blank_renderer.rb | require "json"
class Hypernova::BlankRenderer
def initialize(job)
@job = job
end
def render
<<-HTML
<div data-hypernova-key="#{key}" data-hypernova-id="#{id}"></div>
<script type="application/json" data-hypernova-key="#{key}" data-hypernova-id="#{id}"><!--#{encode}--></script>
HTML
end... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/controller_helpers.rb | lib/hypernova/controller_helpers.rb | require "hypernova/plugin_helper"
require "hypernova/request_service"
module Hypernova
##
# Mixin.
# Implements the high-level rails helper interface.
# Currently untested.
module ControllerHelpers
include Hypernova::PluginHelper
##
# a Rails around_filter to support hypernova batch rendering.
... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/response.rb | lib/hypernova/response.rb | require "json"
class Hypernova::Response
def initialize(request)
@request = request
end
# Example parsed body with no error:
# {
# "0" => {
# "name" => "hello_world.js",
# "html" => "<div>Hello World</div>",
# "meta" => {},
# "duration" => 100,
# "statusCode" => 200,
# ... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/faraday_connection.rb | lib/hypernova/faraday_connection.rb | require "faraday"
require "hypernova/batch_url_builder"
class Hypernova::FaradayConnection
def self.build
configuration = Hypernova.configuration
Faraday.new(
request: {
open_timeout: configuration.open_timeout,
timeout: configuration.timeout,
},
url: Hypernova::BatchUrlBuil... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/batch_url_builder.rb | lib/hypernova/batch_url_builder.rb | require "uri"
class Hypernova::BatchUrlBuilder
def self.base_url
configuration = Hypernova.configuration
builder = configuration.scheme == :https ? URI::HTTPS : URI::HTTP
builder.build(host: configuration.host, port: configuration.port).to_s
end
def self.path
"/batch"
end
end
| ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/http_client_request.rb | lib/hypernova/http_client_request.rb | require "hypernova/batch_url_builder"
class Hypernova::HttpClientRequest
def self.post(payload)
if is_client_requiring_1_argument?
client.post(Hypernova::BatchUrlBuilder.path, payload)
else
client.post(payload)
end
end
def self.client
Hypernova.configuration.http_client
end
def ... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/configuration.rb | lib/hypernova/configuration.rb | require "faraday"
class Hypernova::Configuration
VALID_SCHEMES = [:http, :https].freeze
attr_accessor :http_adapter,
:http_client,
:host,
:open_timeout,
:port,
:scheme,
:timeout
def initialize
@open_timeout = 0.... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/parsed_response.rb | lib/hypernova/parsed_response.rb | require "hypernova/request"
require "hypernova/response"
class Hypernova::ParsedResponse
def initialize(jobs)
@jobs = jobs
end
def body
response.parsed_body
end
private
attr_reader :jobs
def request
Hypernova::Request.new(jobs)
end
def response
Hypernova::Response.new(request)
... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/request.rb | lib/hypernova/request.rb | require "hypernova/faraday_request"
require "hypernova/http_client_request"
class Hypernova::Request
def initialize(jobs)
@jobs = jobs
end
def body
post.body
end
private
attr_reader :jobs
def payload
{
:body => jobs,
:idempotent => true,
:request_format => :json,
:... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/plugin_helper.rb | lib/hypernova/plugin_helper.rb | module Hypernova::PluginHelper
def get_view_data(name, data)
Hypernova.plugins.reduce(data) do |data, plugin|
if plugin.respond_to?(:get_view_data)
plugin.get_view_data(name, data)
else
data
end
end
end
def prepare_request(current_request, original_request)
Hypernova... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/rails/action_controller.rb | lib/hypernova/rails/action_controller.rb | require "hypernova/controller_helpers"
if defined?(ActionController::Base)
ActionController::Base.class_eval do
include Hypernova::ControllerHelpers
helper_method :render_react_component
end
end
| ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
airbnb/hypernova-ruby | https://github.com/airbnb/hypernova-ruby/blob/4889c7180d9c960734fbf6d1e673da25d983e80d/lib/hypernova/plugins/development_mode_plugin.rb | lib/hypernova/plugins/development_mode_plugin.rb | require 'erb'
class DevelopmentModePlugin
def after_response(current_response, _)
current_response.each do |name, result|
current_response[name] = result.merge({ "html" => render(name, result) }) if result["error"]
end
end
private
def render(name, result)
<<-HTML
<div style="backgroun... | ruby | MIT | 4889c7180d9c960734fbf6d1e673da25d983e80d | 2026-01-04T17:41:07.827314Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios_spec.rb | spec/usage_scenarios_spec.rb | require 'spec_helper.rb'
describe "Usage Scenarios" do
files = Dir.glob("spec/usage_scenarios/*_pretty.rb")
scenarios = files.map do |f|
r = /.*\/(?<scenario>.*)_pretty.rb/.match(f)
r['scenario'] ||= nil
end
scenarios.each do |scenario|
it "will test: #{scenario}" do
scenario_file = "spec/usage_scenarios... | ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/spec_helper.rb | spec/spec_helper.rb | require 'digest/md5'
require "codeclimate-test-reporter"
CodeClimate::TestReporter.start
require 'ruby-beautify'
BEAUTIFY_BIN = "#{Dir.pwd}/bin/ruby-beautify"
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/binary_scenarios/count_after.rb | spec/binary_scenarios/count_after.rb | def count
puts "this"
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/binary_scenarios/overwrite.rb | spec/binary_scenarios/overwrite.rb | def ugly
puts 'this'
if true
puts 'is ugly enough'
end
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/binary_scenarios/spaces_before.rb | spec/binary_scenarios/spaces_before.rb | def spaces
puts "are an option"
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/binary_scenarios/small_example.rb | spec/binary_scenarios/small_example.rb | def small
puts 'example'
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/binary_scenarios/count_before.rb | spec/binary_scenarios/count_before.rb | def count
puts "this"
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/binary_scenarios/overwrite_pretty.rb | spec/binary_scenarios/overwrite_pretty.rb | def ugly
puts 'this'
if true
puts 'is ugly enough'
end
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/binary_scenarios/doubled_example.rb | spec/binary_scenarios/doubled_example.rb | def small
puts 'example'
end
def small
puts 'example'
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/binary_scenarios/spaces_after.rb | spec/binary_scenarios/spaces_after.rb | def spaces
puts "are an option"
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/pre_indented_pretty.rb | spec/usage_scenarios/pre_indented_pretty.rb | # Test for already indented blocks
class There2 < There
def m1()
puts "m1"
end
def m2()
puts "m2"
end
def m3()
puts "m3"
end
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/mutli_level_pretty.rb | spec/usage_scenarios/mutli_level_pretty.rb | module Here
class There
def why?(argument = nil)
@array = [
1,
2,
3
]
hash = {
one:1,
two:2,
three:3
}
end
# a comment
def why_not?(argument: {})
@array = [4,5,6]
hash = {four:4, five:5, six:6}
s = "a #{"complex"} string."
end
def complex_method(one, two, thre... | ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/pre_indented_pretty_space.rb | spec/usage_scenarios/pre_indented_pretty_space.rb | # Test for already indented blocks
class There2 < There
def m1()
puts "m1"
end
def m2()
puts "m2"
end
def m3()
puts "m3"
end
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/multiline_strings.rb | spec/usage_scenarios/multiline_strings.rb | # Test for multiline string
def m (x)
puts "This is multi-line string. It's line1 \
It's line 2\
And this is\n line3
This line should not be mutated"
puts "This is multi line interpolated string #{
x
}"
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/case_pretty.rb | spec/usage_scenarios/case_pretty.rb | # Test to validate case statements
def case_test opts=nil
case test_case
when 'Passing'
call(:pass)
when 'Failing'
call(:fail)
when 'Error'
call(:error)
end
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/monolithic_example_pretty.rb | spec/usage_scenarios/monolithic_example_pretty.rb | require 'ripper'
h = Here::There.new
h.why?({
here: 'there',
there: 'here'
})
h.with_block {
puts 'yahooie'
}
h.complex_method('asdkjasflkjdglksjglksfgjlfkgjdf',
'alfkjsdlkfjsflgkjfglk',
'alfkjsdlkfjsflgkjfglk',
'alfkjsdlkfjsflgkjfglk'
)
h.complex_method('asdkjasflkjdglksjglksfgjlfkgjdf',
'alfkjsdlkfjsflgk... | ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/or_equals.rb | spec/usage_scenarios/or_equals.rb | # Test or-equals
def expensive_value
@expensive_value ||= begin
if conn.active?
expensive_call
else
:none
end
end
end
# Test multiple or-equals
def expensive_value
@expensive_value ||= @cached_value ||= begin
if conn.active?
expensive_call
else
:none
end
end
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/lambda_literal.rb | spec/usage_scenarios/lambda_literal.rb | # Test for lambda literal
class ArrowOperator
def one_liner
x = -> (x) {x * x}
end
def one_liner2args
x = -> (x, y) {x * y}
end
def multiline
x = -> (x) {
x * x
}
end
def multiline2args
x = -> (x, y) {
x * y
}
end
def omit_braces
x = -> x {
x * x
}
end
def omit_braces2args
x = -> x, y {
x * y
}
end
def argument_nothing... | ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/pre_indented.rb | spec/usage_scenarios/pre_indented.rb | # Test for already indented blocks
class There2 < There
def m1()
puts "m1"
end
def m2()
puts "m2"
end
def m3()
puts "m3"
end
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/case.rb | spec/usage_scenarios/case.rb | # Test to validate case statements
def case_test opts=nil
case test_case
when 'Passing'
call(:pass)
when 'Failing'
call(:fail)
when 'Error'
call(:error)
end
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/mutli_level.rb | spec/usage_scenarios/mutli_level.rb | module Here
class There
def why?(argument = nil)
@array = [
1,
2,
3
]
hash = {
one:1,
two:2,
three:3
}
end
# a comment
def why_not?(argument: {})
@array = [4,5,6]
hash = {four:4, five:5, six:6}
s = "a #{"complex"} string."
end
def complex_method(one, two, three, four)
regex = /regex/
end
def with_block
run = Proc.ne... | ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/monolithic_example.rb | spec/usage_scenarios/monolithic_example.rb | require 'ripper'
h = Here::There.new
h.why?({
here: 'there',
there: 'here'
})
h.with_block {
puts 'yahooie'
}
h.complex_method('asdkjasflkjdglksjglksfgjlfkgjdf',
'alfkjsdlkfjsflgkjfglk',
'alfkjsdlkfjsflgkjfglk',
'alfkjsdlkfjsflgkjfglk'
)
h.complex_method('asdkjasflkjdglksjglksfgjlfkgjdf',
'alfkjsdlkfjsflgkjfglk',... | ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/from_control.rb | spec/usage_scenarios/from_control.rb | # Test for variable assignment from an if statement
@products = if params[:category]
Category.find(params[:category]).products
else
Product.all
end
# Test for variable assignment from a block
response = begin
if true?
api_call(test)
else
rejected
end
rescue
'FALSE'
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/from_control_pretty.rb | spec/usage_scenarios/from_control_pretty.rb | # Test for variable assignment from an if statement
@products = if params[:category]
Category.find(params[:category]).products
else
Product.all
end
# Test for variable assignment from a block
response = begin
if true?
api_call(test)
else
rejected
end
rescue
'FALSE'
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/multiline_strings_pretty.rb | spec/usage_scenarios/multiline_strings_pretty.rb | # Test for multiline string
def m (x)
puts "This is multi-line string. It's line1 \
It's line 2\
And this is\n line3
This line should not be mutated"
puts "This is multi line interpolated string #{
x
}"
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/lambda_literal_pretty.rb | spec/usage_scenarios/lambda_literal_pretty.rb | # Test for lambda literal
class ArrowOperator
def one_liner
x = -> (x) {x * x}
end
def one_liner2args
x = -> (x, y) {x * y}
end
def multiline
x = -> (x) {
x * x
}
end
def multiline2args
x = -> (x, y) {
x * y
}
end
def omit_braces
x = -> x {
x * x
}
end
def omit_braces2args
x = -> x... | ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/usage_scenarios/or_equals_pretty.rb | spec/usage_scenarios/or_equals_pretty.rb | # Test or-equals
def expensive_value
@expensive_value ||= begin
if conn.active?
expensive_call
else
:none
end
end
end
# Test multiple or-equals
def expensive_value
@expensive_value ||= @cached_value ||= begin
if conn.active?
expensive_call
else
:none
end
end
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/bin/ruby-beautify_spec.rb | spec/bin/ruby-beautify_spec.rb | require 'spec_helper.rb'
describe "Ruby Beautify" do
# This acts as a config block for files and anything else that you may set.
before (:all) do
# a very quick to parse file, since this isn't to test the function of the parser (but the function of the binary).
@small_file = 'spec/binary_scenarios/small_example.... | ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/spec/lib/ruby-beautify_spec.rb | spec/lib/ruby-beautify_spec.rb | require 'spec_helper.rb'
# unit tests suck. But I do want to make sure this one function behaves as expected.
# it simplifies the rest of the testing process (by not requiring multiple passes of each scenario).
describe "Ruby Beautify Library" do
before :all do
@ugly_string = File.open('spec/usage_scenarios/pre_in... | ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/lib/ruby-beautify.rb | lib/ruby-beautify.rb | require 'open3'
require 'ripper'
require 'ruby-beautify/version'
module RubyBeautify
extend self
OPEN_BLOCK_START = ["module", "class", "begin", "def", 'if', 'while', 'unless', 'case']
BOTH_BLOCK = ["else", "elsif", 'rescue', 'when']
OPEN_BLOCK_DO = ['do', '{']
CLOSE_BLOCK = ['end', '}']
OPEN_BRACKETS = [:on... | ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
erniebrodeur/ruby-beautify | https://github.com/erniebrodeur/ruby-beautify/blob/1769290d9916f071426666d34e878b3fc22fda31/lib/ruby-beautify/version.rb | lib/ruby-beautify/version.rb | module RubyBeautify
VERSION = "0.97.4"
end
| ruby | MIT | 1769290d9916f071426666d34e878b3fc22fda31 | 2026-01-04T17:41:10.472142Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/spec/spec_helper.rb | spec/spec_helper.rb | require "simplecov"
require "coveralls"
SimpleCov.formatters = [
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start { add_filter "/spec/" }
require "lita-slack"
require "lita/rspec"
require "pry"
Lita.version_3_compatibility_mode = false
RSpec.configure do |config|
config.m... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/spec/lita/adapters/slack_spec.rb | spec/lita/adapters/slack_spec.rb | require "spec_helper"
describe Lita::Adapters::Slack, lita: true do
subject { described_class.new(robot) }
let(:robot) { Lita::Robot.new(registry) }
let(:rtm_connection) { instance_double('Lita::Adapters::Slack::RTMConnection') }
let(:token) { 'abcd-1234567890-hWYd21AmMH2UHAkx29vb5c1Y' }
before do
regi... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/spec/lita/adapters/slack/im_mapping_spec.rb | spec/lita/adapters/slack/im_mapping_spec.rb | require "spec_helper"
describe Lita::Adapters::Slack::IMMapping do
subject { described_class.new(api, ims) }
let(:api) { instance_double('Lita::Adapters::Slack::API') }
let(:im) { Lita::Adapters::Slack::SlackIM.new('D1234567890', 'U023BECGF') }
describe "#im_for" do
context "when a mapping is already sto... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/spec/lita/adapters/slack/message_handler_spec.rb | spec/lita/adapters/slack/message_handler_spec.rb | require "spec_helper"
describe Lita::Adapters::Slack::MessageHandler, lita: true do
subject { described_class.new(robot, robot_id, data) }
before do
allow(robot).to receive(:trigger)
Lita::Adapters::Slack::RoomCreator.create_room(channel, robot)
end
let(:robot) { instance_double('Lita::Robot', name: ... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/spec/lita/adapters/slack/api_spec.rb | spec/lita/adapters/slack/api_spec.rb | require "spec_helper"
describe Lita::Adapters::Slack::API do
subject { described_class.new(config, stubs) }
let(:http_status) { 200 }
let(:token) { 'abcd-1234567890-hWYd21AmMH2UHAkx29vb5c1Y' }
let(:config) { Lita::Adapters::Slack.configuration_builder.build }
before do
config.token = token
end
des... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/spec/lita/adapters/slack/room_creator_spec.rb | spec/lita/adapters/slack/room_creator_spec.rb | require "spec_helper"
describe Lita::Adapters::Slack::RoomCreator, lita: true do
describe ".create_rooms" do
before { allow(robot).to receive(:trigger) }
let(:robot) { instance_double('Lita::Robot') }
let(:group) do
Lita::Adapters::Slack::SlackChannel.from_data('id' => 'G1234567890', 'name' => 'm... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/spec/lita/adapters/slack/slack_channel_spec.rb | spec/lita/adapters/slack/slack_channel_spec.rb | require "spec_helper"
describe Lita::Adapters::Slack::SlackChannel do
let(:channel_data_1) do
{
"id" => "C2147483705",
"name" => "Room 1",
"created" => 1360782804,
"creator" => 'U023BECGF'
}
end
let(:channel_data_2) do
{
"id" => "C2147483706",
"name" =>... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/spec/lita/adapters/slack/event_loop_spec.rb | spec/lita/adapters/slack/event_loop_spec.rb | require 'spec_helper'
describe Lita::Adapters::Slack::EventLoop, lita: true do
describe '.defer' do
it 'defers the provided block with Eventmachine' do
allow(EM).to receive(:defer).and_yield
ran = false
described_class.defer { ran = true }
expect(ran).to be_truthy
end
end
descr... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/spec/lita/adapters/slack/rtm_connection_spec.rb | spec/lita/adapters/slack/rtm_connection_spec.rb | require "spec_helper"
describe Lita::Adapters::Slack::RTMConnection, lita: true do
def with_websocket(subject, queue)
thread = Thread.new { subject.run(queue, ping: nil) }
thread.abort_on_exception = true
yield queue.pop
subject.shut_down
thread.join
end
subject { described_class.new(robot, ... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/spec/lita/adapters/slack/slack_user_spec.rb | spec/lita/adapters/slack/slack_user_spec.rb | require "spec_helper"
describe Lita::Adapters::Slack::SlackUser do
let(:user_data_1) do
{
"id" => "U023BECGF",
"name" => "bobby",
"real_name" => "Bobby Tables",
"email" => "btables@example.com"
}
end
let(:user_data_2) do
{
"id" => "U024BE7LH",
"name" => "carl",
... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/spec/lita/adapters/slack/user_creator_spec.rb | spec/lita/adapters/slack/user_creator_spec.rb | require "spec_helper"
describe Lita::Adapters::Slack::UserCreator do
before { allow(Lita::User).to receive(:create) }
let(:robot) { instance_double('Lita::Robot') }
before do
allow(robot).to receive(:trigger).with(
:slack_user_created, hash_including(:slack_user)
)
end
describe ".create_user... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/spec/lita/adapters/slack/slack_im_spec.rb | spec/lita/adapters/slack/slack_im_spec.rb | require "spec_helper"
describe Lita::Adapters::Slack::SlackIM do
let(:im_data_1) do
{
"id" => "D024BFF1M",
"is_im" => true,
"user" => "U024BE7LH",
"created" => 1360782804,
}
end
let(:im_data_2) do
{
"id" => "D012ABC3E",
"is_im" => true,
"user" => "U098ZYX7W",... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/spec/lita/adapters/slack/chat_service_spec.rb | spec/lita/adapters/slack/chat_service_spec.rb | require "spec_helper"
describe Lita::Adapters::Slack::ChatService, lita: true do
subject { described_class.new(adapter.config) }
let(:adapter) { Lita::Adapters::Slack.new(robot) }
let(:robot) { Lita::Robot.new(registry) }
let(:room) { Lita::Room.new("C2147483705") }
before do
registry.register_adapter(... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/lib/lita-slack.rb | lib/lita-slack.rb | require "lita"
Lita.load_locales Dir[File.expand_path(
File.join("..", "..", "locales", "*.yml"), __FILE__
)]
require "lita/adapters/slack"
| ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/lib/lita/adapters/slack.rb | lib/lita/adapters/slack.rb | require 'lita/adapters/slack/chat_service'
require 'lita/adapters/slack/rtm_connection'
module Lita
module Adapters
# A Slack adapter for Lita.
# @api private
class Slack < Adapter
# Required configuration attributes.
config :token, type: String, required: true
config :proxy, type: Stri... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/lib/lita/adapters/slack/event_loop.rb | lib/lita/adapters/slack/event_loop.rb | require 'eventmachine'
module Lita
module Adapters
class Slack < Adapter
# @api private
class EventLoop
class << self
def defer
EM.defer { yield }
end
def run
EM.run { yield }
end
def safe_stop
EM.stop if ... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/lib/lita/adapters/slack/im_mapping.rb | lib/lita/adapters/slack/im_mapping.rb | module Lita
module Adapters
class Slack < Adapter
# @api private
class IMMapping
def initialize(api, ims)
@api = api
@mapping = {}
add_mappings(ims)
end
def add_mapping(im)
mapping[im.user_id] = im.id
end
def add_mappin... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/lib/lita/adapters/slack/room_creator.rb | lib/lita/adapters/slack/room_creator.rb | module Lita
module Adapters
class Slack < Adapter
# @api private
class RoomCreator
class << self
def create_room(channel, robot)
Lita::Room.create_or_update(channel.id, name: channel.name)
robot.trigger(:slack_channel_created, slack_channel: channel)
... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
litaio/lita-slack | https://github.com/litaio/lita-slack/blob/8c02e9f7f8776d3c0f9a2bae20152f2966363cce/lib/lita/adapters/slack/rtm_connection.rb | lib/lita/adapters/slack/rtm_connection.rb | require 'faye/websocket'
require 'multi_json'
require 'lita/adapters/slack/api'
require 'lita/adapters/slack/event_loop'
require 'lita/adapters/slack/im_mapping'
require 'lita/adapters/slack/message_handler'
require 'lita/adapters/slack/room_creator'
require 'lita/adapters/slack/user_creator'
module Lita
module Ada... | ruby | MIT | 8c02e9f7f8776d3c0f9a2bae20152f2966363cce | 2026-01-04T17:41:13.277388Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.