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 |
|---|---|---|---|---|---|---|---|---|
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/spec/support.rb | spec/support.rb | # frozen_string_literal:true
def silence_warnings
old_verbose = $VERBOSE
$VERBOSE = nil
yield
ensure
$VERBOSE = old_verbose
end
class TestRailsApp < Rails::Application
config.secret_key_base = 'secret'
end
Sidekiq::Testing.server_middleware do |chain|
chain.add(Cutoff::Sidekiq::ServerMiddleware)
end
| ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/spec/rails/controller_spec.rb | spec/rails/controller_spec.rb | # frozen_string_literal: true
RSpec.describe Cutoff::Rails::Controller, type: :controller do
before do
Timecop.freeze
end
base_controller = Class.new(ActionController::Base) do
def self.name
'TestController'
end
def index
Timecop.travel(Integer(params[:duration]))
Cutoff.check... | ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/spec/patch/net_http_spec.rb | spec/patch/net_http_spec.rb | # frozen_string_literal:true
RSpec.describe Cutoff::Patch::NetHttp do
it 'raises if started after cutoff expired' do
Timecop.freeze
Cutoff.start(2)
Timecop.freeze(3)
expect do
Net::HTTP.get(URI.parse('https://example.com'))
end.to raise_error(Cutoff::CutoffExceededError)
end
it 'does n... | ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/spec/patch/mysql2_spec.rb | spec/patch/mysql2_spec.rb | # frozen_string_literal:true
RSpec.describe 'Cutoff::Patch::Mysql2', if: defined?(Mysql2) do
let(:client) do
Mysql2::Client.new({
username: ENV.fetch('MYSQL_USER', nil),
password: ENV.fetch('MYSQL_PASSWORD', nil),
host: ENV.fetch('MYSQL_HOST', nil),
port: ENV.fetch('MYSQL_PORT', nil),
... | ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/lib/cutoff.rb | lib/cutoff.rb | # frozen_string_literal:true
require 'set'
require 'timeout'
require 'cutoff/version'
require 'cutoff/error'
require 'cutoff/patch'
require 'cutoff/timer'
require 'cutoff/rails'
require 'cutoff/sidekiq' if Gem.loaded_specs['sidekiq']
class Cutoff
CURRENT_STACK_KEY = 'cutoff_deadline_stack'
private_constant :CUR... | ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/lib/cutoff/version.rb | lib/cutoff/version.rb | # frozen_string_literal: true
class Cutoff
# @return [Gem::Version] The current version of the cutoff gem
def self.version
Gem::Version.new('0.5.2')
end
end
| ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/lib/cutoff/rails.rb | lib/cutoff/rails.rb | # frozen_string_literal: true
require 'cutoff/rails/controller' if Gem.loaded_specs['actionpack']
| ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/lib/cutoff/sidekiq.rb | lib/cutoff/sidekiq.rb | # frozen_string_literal: true
require 'sidekiq'
class Cutoff
# Cutoff sidekiq extensions
module Sidekiq
# Add an option `cutoff` for sidekiq workers
#
# @example
# class MyWorker
# include Sidekiq::Worker
#
# sidekiq_options cutoff: 6.0
#
# def perform
# ... | ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/lib/cutoff/patch.rb | lib/cutoff/patch.rb | # frozen_string_literal:true
class Cutoff
# Namespace for patches that are not automatically required
module Patch
end
end
| ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/lib/cutoff/timer.rb | lib/cutoff/timer.rb | # frozen_string_literal:true
class Cutoff
# Tracks the current time for cutoff
module Timer
if defined?(Process::CLOCK_MONOTONIC)
# The current relative time
#
# If it is available, this will use a monotonic clock. This is a clock
# that always moves forward in time and starts at an arb... | ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/lib/cutoff/error.rb | lib/cutoff/error.rb | # frozen_string_literal:true
class Cutoff
# The Cutoff base error class
module CutoffError
private
def message_with_meta(message, **meta)
"#{message}: #{format_meta(**meta)}"
end
def format_meta(**meta)
meta.map { |key, value| "#{key}=#{value}" }.join(' ')
end
end
# Raised by... | ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/lib/cutoff/rails/controller.rb | lib/cutoff/rails/controller.rb | # frozen_string_literal: true
require 'action_controller'
class Cutoff
# Cutoff Rails extensions
module Rails
# Rails controller integration
module Controller
# Set a cutoff for the controller
#
# Can be called multiple times with different options to configure
# cutoffs for variou... | ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/lib/cutoff/patch/mysql2.rb | lib/cutoff/patch/mysql2.rb | # frozen_string_literal: true
require 'strscan'
require 'mysql2'
class Cutoff
module Patch
# Sets the max execution time for SELECT queries if there is an active
# cutoff and it has time remaining. You can select this patch with
# `exclude` or `only` using the checkpoint name `:mysql2`.
module Mysql... | ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
justinhoward/cutoff | https://github.com/justinhoward/cutoff/blob/53f97eacfbc04d24dc9b81f2424eb9d23c9400c3/lib/cutoff/patch/net_http.rb | lib/cutoff/patch/net_http.rb | # frozen_string_literal:true
require 'net/http'
class Cutoff
module Patch
# Set checkpoints for Ruby HTTP requests. Also sets the Net::HTTP timeouts
# to the remaining cutoff time. You can select this patch with
# `exclude` or `only` using the checkpoint name `:net_http`.
module NetHttp
class ... | ruby | MIT | 53f97eacfbc04d24dc9b81f2424eb9d23c9400c3 | 2026-01-04T17:32:12.120116Z | false |
maccman/sinatra-blog | https://github.com/maccman/sinatra-blog/blob/3180c85973ba9a8054839ce404b15e8342b59fc6/app.rb | app.rb | require 'rubygems'
require 'bundler'
# Setup load paths
Bundler.require
$: << File.expand_path('../', __FILE__)
$: << File.expand_path('../lib', __FILE__)
# Require base
require 'sinatra/base'
require 'active_support/core_ext/string'
require 'active_support/core_ext/array'
require 'active_support/core_ext/hash'
requi... | ruby | MIT | 3180c85973ba9a8054839ce404b15e8342b59fc6 | 2026-01-04T17:32:15.612095Z | false |
maccman/sinatra-blog | https://github.com/maccman/sinatra-blog/blob/3180c85973ba9a8054839ce404b15e8342b59fc6/app/extensions.rb | app/extensions.rb | module Blog
module Extensions
autoload :Assets, 'app/extensions/assets'
end
end | ruby | MIT | 3180c85973ba9a8054839ce404b15e8342b59fc6 | 2026-01-04T17:32:15.612095Z | false |
maccman/sinatra-blog | https://github.com/maccman/sinatra-blog/blob/3180c85973ba9a8054839ce404b15e8342b59fc6/app/routes.rb | app/routes.rb | module Blog
module Routes
autoload :Assets, 'app/routes/assets'
autoload :Base, 'app/routes/base'
autoload :Static, 'app/routes/static'
autoload :Posts, 'app/routes/posts'
end
end | ruby | MIT | 3180c85973ba9a8054839ce404b15e8342b59fc6 | 2026-01-04T17:32:15.612095Z | false |
maccman/sinatra-blog | https://github.com/maccman/sinatra-blog/blob/3180c85973ba9a8054839ce404b15e8342b59fc6/app/models.rb | app/models.rb | module Blog
module Models
class NotFound < StandardError; end
autoload :Post, 'app/models/post'
end
end | ruby | MIT | 3180c85973ba9a8054839ce404b15e8342b59fc6 | 2026-01-04T17:32:15.612095Z | false |
maccman/sinatra-blog | https://github.com/maccman/sinatra-blog/blob/3180c85973ba9a8054839ce404b15e8342b59fc6/app/helpers.rb | app/helpers.rb | module Blog
module Helpers
def title
value = yield_content(:title)
value.blank? ? 'Blog' : value
end
def url
request.url
end
def description
value = yield_content(:description)
value.blank? ? '' : (value + '...')
end
def paginate_next_url
number = Int... | ruby | MIT | 3180c85973ba9a8054839ce404b15e8342b59fc6 | 2026-01-04T17:32:15.612095Z | false |
maccman/sinatra-blog | https://github.com/maccman/sinatra-blog/blob/3180c85973ba9a8054839ce404b15e8342b59fc6/app/extensions/assets.rb | app/extensions/assets.rb | require 'sprockets'
require 'stylus/sprockets'
module Blog
module Extensions
module Assets extend self
class UnknownAsset < StandardError; end
module Helpers
def asset_path(name)
asset = settings.assets[name]
raise UnknownAsset, "Unknown asset: #{name}" unless asset
... | ruby | MIT | 3180c85973ba9a8054839ce404b15e8342b59fc6 | 2026-01-04T17:32:15.612095Z | false |
maccman/sinatra-blog | https://github.com/maccman/sinatra-blog/blob/3180c85973ba9a8054839ce404b15e8342b59fc6/app/routes/posts.rb | app/routes/posts.rb | module Blog
module Routes
class Posts < Base
error Models::NotFound do
error 404
end
get '/apple-touch-icon*' do
404
end
get '/feed', provides: 'application/atom+xml' do
@posts = Post.all
builder :feed
end
get '/page/:number' do
... | ruby | MIT | 3180c85973ba9a8054839ce404b15e8342b59fc6 | 2026-01-04T17:32:15.612095Z | false |
maccman/sinatra-blog | https://github.com/maccman/sinatra-blog/blob/3180c85973ba9a8054839ce404b15e8342b59fc6/app/routes/static.rb | app/routes/static.rb | module Blog
module Routes
class Static < Sinatra::Application
configure do
set :views, App.settings.views
set :root, App.settings.root
disable :method_override
disable :protection
enable :static
end
def static!
return if (public_dir = settings.pu... | ruby | MIT | 3180c85973ba9a8054839ce404b15e8342b59fc6 | 2026-01-04T17:32:15.612095Z | false |
maccman/sinatra-blog | https://github.com/maccman/sinatra-blog/blob/3180c85973ba9a8054839ce404b15e8342b59fc6/app/routes/base.rb | app/routes/base.rb | module Blog
module Routes
class Base < Sinatra::Application
configure do
set :views, App.settings.views
set :root, App.settings.root
disable :method_override
disable :protection
disable :static
set :erb, escape_html: true,
layout_options: {... | ruby | MIT | 3180c85973ba9a8054839ce404b15e8342b59fc6 | 2026-01-04T17:32:15.612095Z | false |
maccman/sinatra-blog | https://github.com/maccman/sinatra-blog/blob/3180c85973ba9a8054839ce404b15e8342b59fc6/app/routes/assets.rb | app/routes/assets.rb | module Blog
module Routes
class Assets < Base
get '/assets/*' do
env['PATH_INFO'].sub!(%r{^/assets}, '')
settings.assets.call(env)
end
end
end
end | ruby | MIT | 3180c85973ba9a8054839ce404b15e8342b59fc6 | 2026-01-04T17:32:15.612095Z | false |
maccman/sinatra-blog | https://github.com/maccman/sinatra-blog/blob/3180c85973ba9a8054839ce404b15e8342b59fc6/app/models/post.rb | app/models/post.rb | require 'pathname'
module Blog
module Models
class Post
def self.path
Pathname(App.settings.root) + 'posts'
end
def self.all
paths = Dir[(path + '**' + '*.md').to_s]
posts = paths.map {|p| self.new(p) }
posts.reject! {|p| p.draft? }
posts.sort_by {|p| p.... | ruby | MIT | 3180c85973ba9a8054839ce404b15e8342b59fc6 | 2026-01-04T17:32:15.612095Z | false |
maccman/sinatra-blog | https://github.com/maccman/sinatra-blog/blob/3180c85973ba9a8054839ce404b15e8342b59fc6/lib/tasks/assets.rb | lib/tasks/assets.rb | namespace :assets do
desc 'Precompile assets'
task :precompile => :app do
assets = Blog::Routes::Base.assets
target = Pathname(Blog::App.root) + 'public/assets'
assets.each_logical_path do |logical_path|
if asset = assets.find_asset(logical_path)
filename = target.join(asset.digest_path)
... | ruby | MIT | 3180c85973ba9a8054839ce404b15e8342b59fc6 | 2026-01-04T17:32:15.612095Z | false |
maccman/sinatra-blog | https://github.com/maccman/sinatra-blog/blob/3180c85973ba9a8054839ce404b15e8342b59fc6/config/unicorn.rb | config/unicorn.rb | worker_processes Integer(ENV['UNICORN_WORKERS'] || 4)
timeout 30
preload_app true
listen(ENV['PORT'] || 3000, :backlog => Integer(ENV['UNICORN_BACKLOG'] || 200))
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', ... | ruby | MIT | 3180c85973ba9a8054839ce404b15e8342b59fc6 | 2026-01-04T17:32:15.612095Z | false |
aaronrussell/compass-rgbapng | https://github.com/aaronrussell/compass-rgbapng/blob/71c2072a792f0d3db173e34002e29b3eaf04c4ec/lib/rgbapng.rb | lib/rgbapng.rb | require "rgbapng/functions"
Compass::Frameworks.register("rgbapng",
:stylesheets_directory => File.join(File.dirname(__FILE__), "stylesheets"),
:templates_directory => File.join(File.dirname(__FILE__), "templates")
)
| ruby | MIT | 71c2072a792f0d3db173e34002e29b3eaf04c4ec | 2026-01-04T17:32:15.533942Z | false |
aaronrussell/compass-rgbapng | https://github.com/aaronrussell/compass-rgbapng/blob/71c2072a792f0d3db173e34002e29b3eaf04c4ec/lib/rgbapng/functions.rb | lib/rgbapng/functions.rb | require "rubygems"
require "chunky_png"
require "base64"
# Functions are modified from Benjamin Doherty's first implementations: http://gist.github.com/377912
# Modified to use the ChunkyPNG library rather than RMagick, and added flexibility to amend the path
# to which generated PNGs are saved.
module Sass::Script::... | ruby | MIT | 71c2072a792f0d3db173e34002e29b3eaf04c4ec | 2026-01-04T17:32:15.533942Z | false |
adelevie/ParseModel | https://github.com/adelevie/ParseModel/blob/1d5892ccaaaea642d8afd702c0fa8e7838a10482/lib/ParseModel.rb | lib/ParseModel.rb | require "ParseModel/version"
Motion::Project::App.setup do |app|
Dir.glob(File.join(File.dirname(__FILE__), "ParseModel/*.rb")).each do |file|
app.files.unshift(file)
end
end | ruby | MIT | 1d5892ccaaaea642d8afd702c0fa8e7838a10482 | 2026-01-04T17:32:13.539656Z | false |
adelevie/ParseModel | https://github.com/adelevie/ParseModel/blob/1d5892ccaaaea642d8afd702c0fa8e7838a10482/lib/ParseModel/User.rb | lib/ParseModel/User.rb | module ParseModel
module User
attr_accessor :PFUser
RESERVED_KEYS = ['username', 'password', 'email']
def initialize(pf_user_object=nil)
if pf_user_object
@PFUser = pf_user_object
else
@PFUser = PFUser.user
end
end
def method_missing(method, *args, &block)
... | ruby | MIT | 1d5892ccaaaea642d8afd702c0fa8e7838a10482 | 2026-01-04T17:32:13.539656Z | false |
adelevie/ParseModel | https://github.com/adelevie/ParseModel/blob/1d5892ccaaaea642d8afd702c0fa8e7838a10482/lib/ParseModel/version.rb | lib/ParseModel/version.rb | module ParseModel
VERSION = "0.0.6"
end
| ruby | MIT | 1d5892ccaaaea642d8afd702c0fa8e7838a10482 | 2026-01-04T17:32:13.539656Z | false |
adelevie/ParseModel | https://github.com/adelevie/ParseModel/blob/1d5892ccaaaea642d8afd702c0fa8e7838a10482/lib/ParseModel/query.rb | lib/ParseModel/query.rb | module ParseModel
class ParseQuery < PFQuery
def setClassObject(classObject)
@classObject = classObject
self
end
def initWithClassNameAndClassObject(className, classObject:myClassObject)
@className = className
self.initWithClassName(className)
self.setClassObject(myClas... | ruby | MIT | 1d5892ccaaaea642d8afd702c0fa8e7838a10482 | 2026-01-04T17:32:13.539656Z | false |
adelevie/ParseModel | https://github.com/adelevie/ParseModel/blob/1d5892ccaaaea642d8afd702c0fa8e7838a10482/lib/ParseModel/cloud.rb | lib/ParseModel/cloud.rb |
# with block:
# ParseModel::Cloud.callFunction("myFunction", {"myParam" => "myValue"}) do |result, error|
# # do something...
# end
# without block:
# ParseModel::Cloud.callFunction("myFunction", {"myParam" => "myValue"})
module ParseModel
class Cloud
def self.callFunction(function, params={}, &block)
re... | ruby | MIT | 1d5892ccaaaea642d8afd702c0fa8e7838a10482 | 2026-01-04T17:32:13.539656Z | false |
adelevie/ParseModel | https://github.com/adelevie/ParseModel/blob/1d5892ccaaaea642d8afd702c0fa8e7838a10482/lib/ParseModel/Model.rb | lib/ParseModel/Model.rb | module ParseModel
module Model
attr_accessor :PFObject
def initialize(arg=nil)
if arg.is_a?(PFObject)
@PFObject = arg
else
@PFObject = PFObject.objectWithClassName(self.class.to_s)
if arg.is_a?(Hash)
arg.each do |k,v|
@PFObject.setObject(v, forKey:k)... | ruby | MIT | 1d5892ccaaaea642d8afd702c0fa8e7838a10482 | 2026-01-04T17:32:13.539656Z | false |
kciter/simple-slack-bot | https://github.com/kciter/simple-slack-bot/blob/c77c17806907d6f58c05b6c9b1f2a1f058d17387/spec/version_spec.rb | spec/version_spec.rb | require 'spec_helper'
describe SlackBot do
it 'has a version' do
expect(SlackBot::VERSION).to_not be nil
end
end | ruby | MIT | c77c17806907d6f58c05b6c9b1f2a1f058d17387 | 2026-01-04T17:32:20.354593Z | false |
kciter/simple-slack-bot | https://github.com/kciter/simple-slack-bot/blob/c77c17806907d6f58c05b6c9b1f2a1f058d17387/spec/client_spec.rb | spec/client_spec.rb | require 'spec_helper'
describe SlackBot::Client do
describe '#initialize' do
it 'have an empty commands array' do
expect(SlackBot::Client.new.commands).to eq []
end
end
describe '.add_command' do
bot = SlackBot::Client.new
it 'add command to commands array' do
result = bot.add_comma... | ruby | MIT | c77c17806907d6f58c05b6c9b1f2a1f058d17387 | 2026-01-04T17:32:20.354593Z | false |
kciter/simple-slack-bot | https://github.com/kciter/simple-slack-bot/blob/c77c17806907d6f58c05b6c9b1f2a1f058d17387/spec/command_spec.rb | spec/command_spec.rb | require 'spec_helper'
describe SlackBot::Command do
describe '#initialize' do
bot = SlackBot::Client.new
it 'have a bot_client' do
command = SlackBot::Command.new(bot)
expect(command.bot_client).to eq bot
end
end
describe '.match?' do
bot = SlackBot::Client.new
bot.add_command('... | ruby | MIT | c77c17806907d6f58c05b6c9b1f2a1f058d17387 | 2026-01-04T17:32:20.354593Z | false |
kciter/simple-slack-bot | https://github.com/kciter/simple-slack-bot/blob/c77c17806907d6f58c05b6c9b1f2a1f058d17387/spec/config_spec.rb | spec/config_spec.rb | require 'spec_helper'
describe SlackBot::Config do
describe '#initialize' do
it 'sets config' do
expect(SlackBot.config.join_message).to eq 'Hello!'
expect(SlackBot.config.debug).to eq false
expect(SlackBot.config.token).to eq 'TOKEN'
end
end
describe '#configure' do
before do
... | ruby | MIT | c77c17806907d6f58c05b6c9b1f2a1f058d17387 | 2026-01-04T17:32:20.354593Z | false |
kciter/simple-slack-bot | https://github.com/kciter/simple-slack-bot/blob/c77c17806907d6f58c05b6c9b1f2a1f058d17387/spec/spec_helper.rb | spec/spec_helper.rb | require 'bundler/setup'
Bundler.setup
require 'simple_slack_bot'
RSpec.configure do |config|
end
| ruby | MIT | c77c17806907d6f58c05b6c9b1f2a1f058d17387 | 2026-01-04T17:32:20.354593Z | false |
kciter/simple-slack-bot | https://github.com/kciter/simple-slack-bot/blob/c77c17806907d6f58c05b6c9b1f2a1f058d17387/lib/simple_slack_bot.rb | lib/simple_slack_bot.rb | require 'simple_slack_bot/command'
require 'simple_slack_bot/config'
require 'simple_slack_bot/client'
| ruby | MIT | c77c17806907d6f58c05b6c9b1f2a1f058d17387 | 2026-01-04T17:32:20.354593Z | false |
kciter/simple-slack-bot | https://github.com/kciter/simple-slack-bot/blob/c77c17806907d6f58c05b6c9b1f2a1f058d17387/lib/simple_slack_bot/command.rb | lib/simple_slack_bot/command.rb | module SlackBot
class Command
attr_accessor :bot_client, :regex, :help_message, :action
def initialize(bot_client)
@bot_client = bot_client
end
def match?(str)
(@regex.nil? || @regex.match(str).nil?) ? false : true
end
def execute(data)
return if @action.nil?
@action... | ruby | MIT | c77c17806907d6f58c05b6c9b1f2a1f058d17387 | 2026-01-04T17:32:20.354593Z | false |
kciter/simple-slack-bot | https://github.com/kciter/simple-slack-bot/blob/c77c17806907d6f58c05b6c9b1f2a1f058d17387/lib/simple_slack_bot/version.rb | lib/simple_slack_bot/version.rb | module SlackBot
VERSION = '0.1.2'
end | ruby | MIT | c77c17806907d6f58c05b6c9b1f2a1f058d17387 | 2026-01-04T17:32:20.354593Z | false |
kciter/simple-slack-bot | https://github.com/kciter/simple-slack-bot/blob/c77c17806907d6f58c05b6c9b1f2a1f058d17387/lib/simple_slack_bot/client.rb | lib/simple_slack_bot/client.rb | require 'slack-ruby-client'
module SlackBot
class Client
attr_accessor :slack_web_client, :slack_realtime_client
attr_accessor :commands
attr_accessor(*Config::ATTRIBUTES)
def initialize
@commands = []
end
def add_command(regex)
command = Command.new(self)
command.regex = ... | ruby | MIT | c77c17806907d6f58c05b6c9b1f2a1f058d17387 | 2026-01-04T17:32:20.354593Z | false |
kciter/simple-slack-bot | https://github.com/kciter/simple-slack-bot/blob/c77c17806907d6f58c05b6c9b1f2a1f058d17387/lib/simple_slack_bot/config.rb | lib/simple_slack_bot/config.rb | module SlackBot
module Config
extend self
ATTRIBUTES = [
:debug,
:join_message,
:token
]
attr_accessor(*Config::ATTRIBUTES)
self.debug = false
self.join_message = 'Hello!'
self.token = 'TOKEN'
end
module_function
def configure
block_given? ? yield(Config) :... | ruby | MIT | c77c17806907d6f58c05b6c9b1f2a1f058d17387 | 2026-01-04T17:32:20.354593Z | false |
KrauseFx/instapipe | https://github.com/KrauseFx/instapipe/blob/edee82b9483b39c4d77547e50581b8cc77db637f/facebook_token.rb | facebook_token.rb | require_relative "./database"
require "net/https"
# FB Login flow docs
# https://developers.facebook.com/docs/facebook-login/guides/advanced/manual-flow
module Instapipe
class FacebookToken
attr_accessor :user_id
# user_id: that's the business user id
# https://developers.facebook.com/docs/instagram-ap... | ruby | MIT | edee82b9483b39c4d77547e50581b8cc77db637f | 2026-01-04T17:32:07.555956Z | false |
KrauseFx/instapipe | https://github.com/KrauseFx/instapipe/blob/edee82b9483b39c4d77547e50581b8cc77db637f/scheduler.rb | scheduler.rb | require_relative "./instagram.rb"
puts "Starting cronjob"
loop do
refresh_stories_and_posts
sleep(60 * 60) # sleep for 1 hour
end
| ruby | MIT | edee82b9483b39c4d77547e50581b8cc77db637f | 2026-01-04T17:32:07.555956Z | false |
KrauseFx/instapipe | https://github.com/KrauseFx/instapipe/blob/edee82b9483b39c4d77547e50581b8cc77db637f/instagram.rb | instagram.rb | require 'net/http'
require 'marcel'
require 'net/https'
require 'open-uri'
require 'pry'
require 'json'
require 'telegram/bot'
require_relative "./database"
module Instapipe
class Instagram
attr_accessor :access_token
attr_accessor :user_id
attr_accessor :telegram_client
def initialize(fb_token_entr... | ruby | MIT | edee82b9483b39c4d77547e50581b8cc77db637f | 2026-01-04T17:32:07.555956Z | false |
KrauseFx/instapipe | https://github.com/KrauseFx/instapipe/blob/edee82b9483b39c4d77547e50581b8cc77db637f/server.rb | server.rb | require 'sinatra'
require_relative "./database"
require_relative "./facebook_token"
set :bind, '0.0.0.0'
set :port, ENV.fetch("PORT")
set :environment, :production unless ENV["DEVELOPMENT"].to_s.length > 0
REDIRECT_URI = "https://instapipe.net/fb/auth"
get '/' do
# Render login page
@login_url = URI("https://www... | ruby | MIT | edee82b9483b39c4d77547e50581b8cc77db637f | 2026-01-04T17:32:07.555956Z | false |
KrauseFx/instapipe | https://github.com/KrauseFx/instapipe/blob/edee82b9483b39c4d77547e50581b8cc77db637f/database.rb | database.rb | require "sequel"
require "google/cloud/storage"
class Database
def self.database
@_db ||= Sequel.connect(ENV["DATABASE_URL"])
unless @_db.table_exists?("stories")
@_db.create_table :stories do
primary_key :id
String :ig_id
String :signed_url
String :bucket_path
... | ruby | MIT | edee82b9483b39c4d77547e50581b8cc77db637f | 2026-01-04T17:32:07.555956Z | false |
nooverviewavailable/NoOverviewAvailable.com | https://github.com/nooverviewavailable/NoOverviewAvailable.com/blob/4834109f4c49911e4ee7f4c7c8bfc19f168ff8c3/lib/apple_developer_spider.rb | lib/apple_developer_spider.rb | # frozen_string_literal: true
require 'open-uri'
require 'fileutils'
require 'net/http'
require 'parallel'
require 'kimurai'
require 'nokogiri'
require 'mechanize'
require 'odyssey'
class AppleDeveloperSpider < Kimurai::Base
@engine = :mechanize
@start_urls = ['https://developer.apple.com/documentation/']
@con... | ruby | MIT | 4834109f4c49911e4ee7f4c7c8bfc19f168ff8c3 | 2026-01-04T17:32:19.364496Z | false |
nooverviewavailable/NoOverviewAvailable.com | https://github.com/nooverviewavailable/NoOverviewAvailable.com/blob/4834109f4c49911e4ee7f4c7c8bfc19f168ff8c3/_plugins/percentage_of-filter.rb | _plugins/percentage_of-filter.rb | # frozen_string_literal: true
require 'active_support/all'
module Jekyll
module PercentageOfFilter
def percentage_of(part, whole)
return 'n/a' if whole.zero?
ActiveSupport::NumberHelper.number_to_percentage(((part.to_f / whole.to_f) * 100.0), precision: 3, significant: true)
end
end
end
Liqu... | ruby | MIT | 4834109f4c49911e4ee7f4c7c8bfc19f168ff8c3 | 2026-01-04T17:32:19.364496Z | false |
nooverviewavailable/NoOverviewAvailable.com | https://github.com/nooverviewavailable/NoOverviewAvailable.com/blob/4834109f4c49911e4ee7f4c7c8bfc19f168ff8c3/_plugins/well-known-hook.rb | _plugins/well-known-hook.rb | # frozen_string_literal: true
require 'fileutils'
Jekyll::Hooks.register :site, :post_write do |site|
site.static_files.select do |f|
next unless f.relative_path.include?('.well-known')
FileUtils.cp(f.path, site.dest)
end
end
| ruby | MIT | 4834109f4c49911e4ee7f4c7c8bfc19f168ff8c3 | 2026-01-04T17:32:19.364496Z | false |
nooverviewavailable/NoOverviewAvailable.com | https://github.com/nooverviewavailable/NoOverviewAvailable.com/blob/4834109f4c49911e4ee7f4c7c8bfc19f168ff8c3/_plugins/data-pages-generator.rb | _plugins/data-pages-generator.rb | # frozen_string_literal: true
require 'i18n'
require 'parallel'
I18n.config.available_locales = :en
module Jekyll
module Sanitizer
def sanitize_file_path_component(name)
I18n.transliterate(name.to_s).downcase.strip.gsub(' ', '-').gsub(/[^\w.-]/, '')
end
end
class OverviewPage < Page
include... | ruby | MIT | 4834109f4c49911e4ee7f4c7c8bfc19f168ff8c3 | 2026-01-04T17:32:19.364496Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/spec_helper.rb | spec/spec_helper.rb | $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
require 'simplabs/excellent'
begin
require 'ruby-debug'
Debugger.start
Debugger.settings[:autoeval] = true if Debugger.respond_to?(:settings)
rescue LoadError
# ruby-debug wasn't available so neither can the debugging be
end
| ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/issues/29_spec.rb | spec/issues/29_spec.rb | require 'spec_helper'
describe 'issue #29' do
before(:each) do
@excellent = Simplabs::Excellent::Runner.new([:'Rails::ValidationsCheck' => {}])
end
it 'is fixed' do
validators = [
'validate :must_be_friends',
'validates :terms, acceptance: true',
'validates! :name, presence: true',
... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/issues/28_spec.rb | spec/issues/28_spec.rb | require 'spec_helper'
describe 'issue #28' do
before(:each) do
@excellent = Simplabs::Excellent::Runner.new([:MethodNameCheck => {}])
end
it 'is fixed' do
Simplabs::Excellent::Checks::MethodNameCheck::DEFAULT_WHITELIST.each do |special_method|
code = <<-END
class Klass
def #{spe... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/issues/24_spec.rb | spec/issues/24_spec.rb | require 'spec_helper'
describe 'issue #24' do
before(:each) do
@excellent = Simplabs::Excellent::Runner.new([:ClassVariableCheck => {}])
end
it 'is fixed' do
code = <<-END
{
a: 1,
b: 2,
c: 3
}.inject(0) do |sum, (key, value)|
sum += value
end
END
... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/issues/27_spec.rb | spec/issues/27_spec.rb | require 'spec_helper'
describe 'issue #27' do
before(:each) do
@excellent = Simplabs::Excellent::Runner.new([:'Rails::CustomInitializeMethodCheck' => {}])
end
context 'when no initialize method is defined' do
it 'is fixed' do
code = <<-END
class Model < ActiveRecord::Base
end
... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/parameter_number_check_spec.rb | spec/unit/checks/parameter_number_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::ParameterNumberCheck do
before(:each) do
@excellent = Simplabs::Excellent::Runner.new([:ParameterNumberCheck => { :threshold => 1 }])
end
describe '#evaluate' do
it 'should accept methods with less parameters than the threshold' do
code... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/class_variable_check_spec.rb | spec/unit/checks/class_variable_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::ClassVariableCheck do
before(:each) do
@excellent = Simplabs::Excellent::Runner.new([:ClassVariableCheck => {}])
end
describe '#evaluate' do
it 'should reject class variables' do
code = <<-END
@@foo
END
@excellent.ch... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/case_missing_else_check_spec.rb | spec/unit/checks/case_missing_else_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::CaseMissingElseCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:CaseMissingElseCheck => {}])
end
describe '#evaluate' do
it 'should accept case statements that do have an else clause' do
code = <<-END
case foo
... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/abc_metric_method_check_spec.rb | spec/unit/checks/abc_metric_method_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::AbcMetricMethodCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:AbcMetricMethodCheck => { :threshold => 0 }])
end
describe '#evaluate' do
describe 'when processing assignments' do
it "should find =" do
code = <... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/empty_rescue_body_check_spec.rb | spec/unit/checks/empty_rescue_body_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::EmptyRescueBodyCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:EmptyRescueBodyCheck => {}])
end
describe '#evaluate' do
it 'should accept a rescue body with content and no parameter' do
code = <<-END
begin
... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/method_line_count_check_spec.rb | spec/unit/checks/method_line_count_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::MethodLineCountCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:MethodLineCountCheck => { :threshold => 2 }])
end
describe '#evaluate' do
it 'should accept methods with less lines than the threshold' do
code = <<-END
... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/module_name_check_spec.rb | spec/unit/checks/module_name_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::ModuleNameCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:ModuleNameCheck => {}])
end
describe '#evaluate' do
it 'should accept camel case module names starting in capitals' do
code = <<-END
module GoodModuleNa... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/flog_block_check_spec.rb | spec/unit/checks/flog_block_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::FlogBlockCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:FlogBlockCheck => { :threshold => 0 }])
end
describe '#evaluate' do
it 'should calculate the score correctly' do
code = <<-END
method_name do
p... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/method_name_check_spec.rb | spec/unit/checks/method_name_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::MethodNameCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:MethodNameCheck => {}])
end
describe '#evaluate' do
it 'should accept method names with underscores' do
code = <<-END
def good_method_name
end
... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/cyclomatic_complexity_block_check_spec.rb | spec/unit/checks/cyclomatic_complexity_block_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::CyclomaticComplexityBlockCheck do
before(:each) do
@excellent = Simplabs::Excellent::Runner.new([:CyclomaticComplexityBlockCheck => { :threshold => 0 }])
end
describe '#evaluate' do
it 'should find a simple block' do
code = <<-END
... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/class_name_check_spec.rb | spec/unit/checks/class_name_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::ClassNameCheck do
before(:each) do
@excellent = Simplabs::Excellent::Runner.new([:ClassNameCheck => {}])
end
describe '#evaluate' do
it 'should accept camel case class names starting in capitals' do
code = <<-END
class GoodClass... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/flog_class_check_spec.rb | spec/unit/checks/flog_class_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::FlogClassCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:FlogClassCheck => { :threshold => 0 }])
end
describe '#evaluate' do
it 'should calculate the score correctly' do
code = <<-END
class User < ActiveRecord:... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/flog_method_check_spec.rb | spec/unit/checks/flog_method_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::FlogMethodCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:FlogMethodCheck => { :threshold => 0 }])
end
describe '#evaluate' do
it 'should calculate the score correctly' do
code = <<-END
def method_name
... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/assignment_in_conditional_check_spec.rb | spec/unit/checks/assignment_in_conditional_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::AssignmentInConditionalCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:AssignmentInConditionalCheck => {}])
end
describe '#evaluate' do
it 'should accept an assignment before an if clause' do
code = <<-END
coun... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/global_variable_check_spec.rb | spec/unit/checks/global_variable_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::GlobalVariableCheck do
before(:each) do
@excellent = Simplabs::Excellent::Runner.new([:GlobalVariableCheck => {}])
end
describe '#evaluate' do
it 'should reject global variables' do
code = <<-END
$foo = 'bar'
END
@ex... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/nested_iterators_check_spec.rb | spec/unit/checks/nested_iterators_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::NestedIteratorsCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:NestedIteratorsCheck => {}])
end
describe '#evaluate' do
it 'should reject a block inside a block' do
code = <<-END
method1 do
method2 do... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/class_line_count_check_spec.rb | spec/unit/checks/class_line_count_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::ClassLineCountCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:ClassLineCountCheck => { :threshold => 3 }])
end
describe '#evaluate' do
it 'should accept classes with less lines than the threshold' do
code = <<-END
... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/for_loop_check_spec.rb | spec/unit/checks/for_loop_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::ForLoopCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:ForLoopCheck => {}])
end
describe '#evaluate' do
it 'should accept iterators' do
code = <<-END
[:sym1, :sym2].each do |sym|
end
END
@ex... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/module_line_count_check_spec.rb | spec/unit/checks/module_line_count_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::ModuleLineCountCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:ModuleLineCountCheck => { :threshold => 2 }])
end
describe '#evaluate' do
it 'should accept modules with less lines than the threshold' do
code = <<-END
... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/cyclomatic_complexity_method_check_spec.rb | spec/unit/checks/cyclomatic_complexity_method_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::CyclomaticComplexityMethodCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:CyclomaticComplexityMethodCheck => { :threshold => 0 }])
end
describe '#evaluate' do
it 'should find an if block' do
code = <<-END
def m... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/control_coupling_check_spec.rb | spec/unit/checks/control_coupling_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::ControlCouplingCheck do
before(:each) do
@excellent = Simplabs::Excellent::Runner.new([:ControlCouplingCheck => {}])
end
describe '#evaluate' do
it 'should accept methods that just print out the parameter' do
code = <<-END
def w... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/rails/attr_accessible_check_spec.rb | spec/unit/checks/rails/attr_accessible_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::Rails::AttrAccessibleCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:'Rails::AttrAccessibleCheck' => {}])
end
describe '#evaluate' do
it 'should ignore classes that are not active record models' do
code = <<-END
... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/rails/instance_var_in_partial_check_spec.rb | spec/unit/checks/rails/instance_var_in_partial_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::Rails::InstanceVarInPartialCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:'Rails::InstanceVarInPartialCheck' => {}])
end
describe '#evaluate' do
it 'should accept partials that do not use instance variables' do
code =... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/rails/validations_check_spec.rb | spec/unit/checks/rails/validations_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::Rails::ValidationsCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:'Rails::ValidationsCheck' => {}])
end
describe '#evaluate' do
it 'should ignore classes that are not active record models' do
code = <<-END
clas... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/rails/session_hash_in_view_check_spec.rb | spec/unit/checks/rails/session_hash_in_view_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::Rails::SessionHashInViewCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:'Rails::SessionHashInViewCheck' => {}])
end
describe '#evaluate' do
it 'should accept views that do not use the session hash' do
code = <<-END
... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/rails/attr_protected_check_spec.rb | spec/unit/checks/rails/attr_protected_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::Rails::AttrProtectedCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:'Rails::AttrProtectedCheck' => {}])
end
describe '#evaluate' do
it 'should ignore classes that are not active record models' do
code = <<-END
... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/rails/custom_initialize_method_check_spec.rb | spec/unit/checks/rails/custom_initialize_method_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::Rails::CustomInitializeMethodCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:'Rails::CustomInitializeMethodCheck' => {}])
end
describe '#evaluate' do
it 'should ignore classes that are not active record models' do
code... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/spec/unit/checks/rails/params_hash_in_view_check_spec.rb | spec/unit/checks/rails/params_hash_in_view_check_spec.rb | require 'spec_helper'
describe Simplabs::Excellent::Checks::Rails::ParamsHashInViewCheck do
before do
@excellent = Simplabs::Excellent::Runner.new([:'Rails::ParamsHashInViewCheck' => {}])
end
describe '#evaluate' do
it 'should accept views that do not use the params hash' do
code = <<-END
... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/lib/simplabs/excellent.rb | lib/simplabs/excellent.rb | require 'simplabs/excellent/checks'
require 'simplabs/excellent/parsing'
require 'simplabs/excellent/formatters'
require 'simplabs/excellent/runner'
require 'sexp'
require 'hashr'
module Simplabs #:nodoc:
module Excellent #:nodoc:
VERSION = '2.1.1'
end
end
| ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/lib/simplabs/excellent/formatters.rb | lib/simplabs/excellent/formatters.rb | module Simplabs
module Excellent
module Formatters #:nodoc:
end
end
end
require 'simplabs/excellent/formatters/text'
require 'simplabs/excellent/formatters/html' | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/lib/simplabs/excellent/warning.rb | lib/simplabs/excellent/warning.rb | module Simplabs
module Excellent
# The warnings returned by Excellent provide information about the +file+ the *possibly* problematic code was found in as well as the +line+ of the
# occurence, a warning message and a Hash with specific information about the warning.
#
# Warnings also provide the me... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/lib/simplabs/excellent/runner.rb | lib/simplabs/excellent/runner.rb | require 'pp'
require 'yaml'
require 'simplabs/excellent/parsing/parser'
require 'simplabs/excellent/parsing/code_processor'
module Simplabs
module Excellent
# The Runner is the interface to invoke parsing and processing of source code. You can pass either a String containing the code to process or the
# na... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/lib/simplabs/excellent/parsing.rb | lib/simplabs/excellent/parsing.rb | module Simplabs
module Excellent
module Parsing #:nodoc:
end
end
end
| ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/lib/simplabs/excellent/rake.rb | lib/simplabs/excellent/rake.rb | require 'simplabs/excellent/rake/excellent_task' | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/lib/simplabs/excellent/checks.rb | lib/simplabs/excellent/checks.rb | module Simplabs
module Excellent
module Checks #:nodoc:
end
end
end
require 'simplabs/excellent/checks/abc_metric_method_check'
require 'simplabs/excellent/checks/assignment_in_conditional_check'
require 'simplabs/excellent/checks/case_missing_else_check'
require 'simplabs/excellent/checks/class_line_c... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/lib/simplabs/excellent/parsing/abc_measure.rb | lib/simplabs/excellent/parsing/abc_measure.rb | module Simplabs
module Excellent
module Parsing
module AbcMeasure #:nodoc:
CONDITIONS = [:==, :<=, :>=, :<, :>]
def process_lasgn(exp)
@assignments ||= 0
@assignments += 1
super
end
def process_call(exp)
handle_call(exp)
... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/lib/simplabs/excellent/parsing/resbody_context.rb | lib/simplabs/excellent/parsing/resbody_context.rb | module Simplabs
module Excellent
module Parsing
class ResbodyContext < SexpContext #:nodoc:
STATEMENT_NODES = [:fcall, :return, :attrasgn, :vcall, :call, :str, :lit, :hash, :false, :true, :nil]
def initialize(exp, parent)
super
@contains_statements = contains_stateme... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/lib/simplabs/excellent/parsing/block_context.rb | lib/simplabs/excellent/parsing/block_context.rb | require 'simplabs/excellent/parsing/cyclomatic_complexity_measure'
module Simplabs
module Excellent
module Parsing
class BlockContext < SexpContext #:nodoc:
include CyclomaticComplexityMeasure
include FlogMeasure
attr_reader :parameters
attr_reader :calls
def i... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/lib/simplabs/excellent/parsing/constant_context.rb | lib/simplabs/excellent/parsing/constant_context.rb | module Simplabs
module Excellent
module Parsing
class ConstantContext < SexpContext #:nodoc:
def initialize(exp, parent)
super
@name = exp[1]
end
end
end
end
end
| ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/lib/simplabs/excellent/parsing/if_context.rb | lib/simplabs/excellent/parsing/if_context.rb | require 'simplabs/excellent/parsing/conditional_context'
module Simplabs
module Excellent
module Parsing
class IfContext < ConditionalContext #:nodoc:
def initialize(exp, parent)
super
@contains_assignment = has_assignment?
@tests_parameter = contains_parameter... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
mainmatter/excellent | https://github.com/mainmatter/excellent/blob/6097becb3090986b1aa2defe48d994f8c70f531d/lib/simplabs/excellent/parsing/cvar_context.rb | lib/simplabs/excellent/parsing/cvar_context.rb | module Simplabs
module Excellent
module Parsing
class CvarContext < SexpContext #:nodoc:
def initialize(exp, parent)
super
@name = exp[1].to_s.sub(/^@+/, '')
end
def full_name
return @name if !@parent
full_name = @name
parent ... | ruby | MIT | 6097becb3090986b1aa2defe48d994f8c70f531d | 2026-01-04T17:32:22.850230Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.