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 |
|---|---|---|---|---|---|---|---|---|
chef/mixlib-shellout | https://github.com/chef/mixlib-shellout/blob/08c2734f5f7861603b7a825f162d10ea1cab2582/lib/mixlib/shellout/exceptions.rb | lib/mixlib/shellout/exceptions.rb | module Mixlib
class ShellOut
class Error < RuntimeError; end
class ShellCommandFailed < Error; end
class CommandTimeout < Error; end
class InvalidCommandOption < Error; end
class EmptyWindowsCommand < ShellCommandFailed; end
end
end
| ruby | Apache-2.0 | 08c2734f5f7861603b7a825f162d10ea1cab2582 | 2026-01-04T17:46:55.301314Z | false |
chef/mixlib-shellout | https://github.com/chef/mixlib-shellout/blob/08c2734f5f7861603b7a825f162d10ea1cab2582/lib/mixlib/shellout/unix.rb | lib/mixlib/shellout/unix.rb | # frozen_string_literal: true
#
# Author:: Daniel DeLeo (<dan@chef.io>)
# Copyright:: Copyright (c) Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of... | ruby | Apache-2.0 | 08c2734f5f7861603b7a825f162d10ea1cab2582 | 2026-01-04T17:46:55.301314Z | false |
chef/mixlib-shellout | https://github.com/chef/mixlib-shellout/blob/08c2734f5f7861603b7a825f162d10ea1cab2582/lib/mixlib/shellout/helper.rb | lib/mixlib/shellout/helper.rb | #--
# Author:: Daniel DeLeo (<dan@chef.io>)
# Copyright:: Copyright (c) Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http... | ruby | Apache-2.0 | 08c2734f5f7861603b7a825f162d10ea1cab2582 | 2026-01-04T17:46:55.301314Z | false |
chef/mixlib-shellout | https://github.com/chef/mixlib-shellout/blob/08c2734f5f7861603b7a825f162d10ea1cab2582/lib/mixlib/shellout/windows.rb | lib/mixlib/shellout/windows.rb | #
# frozen_string_literal: true
# Author:: Daniel DeLeo (<dan@chef.io>)
# Author:: John Keiser (<jkeiser@chef.io>)
# Author:: Ho-Sheng Hsiao (<hosh@chef.io>)
# Copyright:: Copyright (c) Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ... | ruby | Apache-2.0 | 08c2734f5f7861603b7a825f162d10ea1cab2582 | 2026-01-04T17:46:55.301314Z | false |
chef/mixlib-shellout | https://github.com/chef/mixlib-shellout/blob/08c2734f5f7861603b7a825f162d10ea1cab2582/lib/mixlib/shellout/windows/core_ext.rb | lib/mixlib/shellout/windows/core_ext.rb | #
# Author:: Daniel DeLeo (<dan@chef.io>)
# Author:: John Keiser (<jkeiser@chef.io>)
# Copyright:: Copyright (c) Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... | ruby | Apache-2.0 | 08c2734f5f7861603b7a825f162d10ea1cab2582 | 2026-01-04T17:46:55.301314Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/uninstall.rb | uninstall.rb | # Uninstall hook code here
| ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/install.rb | install.rb | # Install hook code here
| ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/init.rb | init.rb | require 'smerf' | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/app/helpers/smerf_test.rb | app/helpers/smerf_test.rb | module SmerfTestHelper
end
| ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/app/helpers/smerf_forms_helper.rb | app/helpers/smerf_forms_helper.rb | require "smerf_system_helpers"
# This module contains all the helper methods used by the smerf form views.
module SmerfFormsHelper
include SmerfSystemHelpers
# This method creates a formatted error message that is then
# displayed on the smerf form page to inform the user of any errors.
#
# CSS identifier... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/app/controllers/smerf_test_controller.rb | app/controllers/smerf_test_controller.rb | class SmerfTestController < ApplicationController
include Smerf
def index
# Set the record ID for the user accessing the smerf
# normally this would be done by the authentication code
# for the application, the test app does not use authentication
# so we set it here as an example
self.sm... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/app/models/smerf_answer.rb | app/models/smerf_answer.rb | # This class contains details about answers to form questions, it derives from
# SmerfItem.
#
# It knows how to handle subquestions. Subquestions are additional questions
# that a user can answer if certain answers are selected. An example subquestion
# would be where an <em>Other</em> is provided as one of the answer... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/app/models/smerf_meta_form.rb | app/models/smerf_meta_form.rb | # This class contains details about the form, it derives from SmerfItem.
#
# When setting up a new form the first thing we do is define some settings for
# the form as a whole. Currently the following items can be defined for the form:
#
# name:: Name of the form (mandatory)
# welcome:: Message displayed at the start... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/app/models/smerf_question.rb | app/models/smerf_question.rb | # This class contains details about form questions, it derives from
# SmerfItem.
#
# A group can contain any number of questions, there must be at least one question
# per group. When defining a question you must specify the question type,
# the type determines the type of form field that will be created.
# There a... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/app/models/smerf_item.rb | app/models/smerf_item.rb | # SmerfItem class is a base class used by all other smerf classes
# and contains shared functionality.
#
# Derived classes include:
#
# * SmerfMetaForm
# * SmerfGroup
# * SmerfQuestion
# * SmerfAnswer
#
class SmerfItem
attr_accessor :child_items, :data_id, :item_id, :parent_id
def initialize(parent_id='',... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/app/models/smerf_file.rb | app/models/smerf_file.rb | # This class contains functions to work with the smerf form definition file. It
# will read the file validating the format of the file, if any errors are
# found a <em>RuntimeError</em> exception will be raised.
#
# Once the file has been validated all objects created during the process
# will be serialized to the sm... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/app/models/smerf_form.rb | app/models/smerf_form.rb | # Require required for mixin of helper methods
require "smerf_system_helpers"
require "smerf_helpers"
# This model class manages the smerf_forms DB table and stores details about smerf forms.
# One of the main function it performs it to rebuild a form from a form
# definition file if required.
#
class SmerfForm < ... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/app/models/smerf_group.rb | app/models/smerf_group.rb | # This class contains details about smerf form groups, it derives from
# SmerfItem.
#
# Each form is divided up into groups of questions, you must have at least one
# group per form. Here are the fields that are currently available when
# defining a group:
#
# code:: This code must be unique for all groups within th... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/lib/smerf.rb | lib/smerf.rb | %w{ models controllers helpers views}.each do |dir|
path = File.join(File.dirname(__FILE__), 'app', dir)
model_path = path if path.include?('models')
$LOAD_PATH << path
ActiveSupport::Dependencies.autoload_paths << path
ActiveSupport::Dependencies.autoload_once_paths.delete(path)
end
# Include smerf class... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/lib/smerf_system_helpers.rb | lib/smerf_system_helpers.rb | # This module contains some standard helper methods used by smerf.
#
# All validation methods need to take three parameters:
# question:: The SmerfQuestion object to be validated
# responses:: Hash containing user responses keyed using the question code
# form:: Hash that contains all form objects including groups, qu... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/lib/generators/smerf_generator.rb | lib/generators/smerf_generator.rb | require 'rails/generators/migration'
class SmerfGenerator < Rails::Generators::NamedBase
source_root File.expand_path('../templates', __FILE__)
include Rails::Generators::Migration
class_option :skip_migration, :type => :boolean, :desc => "Don't generate a migration file for the Smerf tables."
attr_ac... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/lib/generators/templates/smerf_init.rb | lib/generators/templates/smerf_init.rb | # Include hook code here
model_path = ''
# Setup additional application directory paths
%w(controllers helpers models views).each do |code_dir|
file_path = File.join(directory, 'app', code_dir)
$LOAD_PATH << file_path
ActiveSupport::Dependencies.load_paths << file_path
# Tell Rails where to look for out plugin... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/lib/generators/templates/app/controllers/smerf_forms_controller.rb | lib/generators/templates/app/controllers/smerf_forms_controller.rb | # This controller contains methods that displays the smerf form, allows
# the user to answer or edit responses on the form. The controller has
# been developed using REST and responds to the following requests:
#
# * GET /smerf_forms/smerf_form_file_name - displays specified smerf form
# * POST /smerf_forms - creates a... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/lib/generators/templates/app/models/smerf_forms_user.rb | lib/generators/templates/app/models/smerf_forms_user.rb | # This model class manages the smerf_forms_users DB table. It stores a a record
# for each form a user completes.
#
class <%= link_table_model_class_name %> < ActiveRecord::Base
has_many :smerf_responses,
:dependent => :destroy
validates_presence_of :responses
validates_presence_of :<%= user_table_fk... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/lib/generators/templates/app/models/smerf_response.rb | lib/generators/templates/app/models/smerf_response.rb | # This model class manages the smerf_responses DB table. It stores the users
# responses to questions on a smerf form.
#
# The users responses to questions on a form are stored in the smerf_responses
# table which stores a separate record for each response to a question. If a
# question has multiple answers then m... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/lib/generators/templates/lib/smerf_helpers.rb | lib/generators/templates/lib/smerf_helpers.rb | require 'smerf_system_helpers'
# This module contains helper methods used by smerf, in particular
# custom user defined validation methods that are used to validate user responses.
#
# All validation methods need to take three parameters:
# question:: The SmerfQuestion object to be validated
# responses:: Hash contai... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
springbok/smerf | https://github.com/springbok/smerf/blob/e75ee66c599918a51257a02e5cd1b5625ebfcb9d/lib/generators/templates/migrate/create_smerfs.rb | lib/generators/templates/migrate/create_smerfs.rb | class CreateSmerfs < ActiveRecord::Migration
def self.up
# Create table to hold smerf form data
create_table :smerf_forms, :primary_key => :id, :force => true do |t|
t.string :name, :null => false
t.string :code, :null => false
t.integer :active, :null => fal... | ruby | MIT | e75ee66c599918a51257a02e5cd1b5625ebfcb9d | 2026-01-04T17:47:00.942481Z | false |
basecamp/platform_agent | https://github.com/basecamp/platform_agent/blob/fc4b05267986bb49ae05b109a7a2a82c74fade73/test/platform_agent_test.rb | test/platform_agent_test.rb | require 'active_support'
require 'active_support/testing/autorun'
require 'platform_agent'
class BasecampAgent < PlatformAgent
def ios_app?
match? /BC3 iOS/
end
def android_app?
match? /BC3 Android/
end
def mac_app?
match?(/Electron/) && match?(/basecamp3/) && match?(/Macintosh/)
end
def ... | ruby | MIT | fc4b05267986bb49ae05b109a7a2a82c74fade73 | 2026-01-04T17:47:02.594581Z | false |
basecamp/platform_agent | https://github.com/basecamp/platform_agent/blob/fc4b05267986bb49ae05b109a7a2a82c74fade73/lib/platform_agent.rb | lib/platform_agent.rb | require "user_agent"
class PlatformAgent
def initialize(user_agent_string)
self.user_agent_string = user_agent_string
end
delegate :browser, :version, :product, :os, to: :user_agent
def desktop?
!mobile?
end
def mobile?
phone? || tablet? || mobile_app?
end
def phone?
iphone? || andr... | ruby | MIT | fc4b05267986bb49ae05b109a7a2a82c74fade73 | 2026-01-04T17:47:02.594581Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/spec/spec_helper.rb | spec/spec_helper.rb | require 'simplecov'
require 'webmock'
require 'vcr'
require 'pry' if RUBY_VERSION > "1.8.7"
class InceptionFormatter
def format(result)
Coveralls::SimpleCov::Formatter.new.format(result)
end
end
def setup_formatter
SimpleCov.formatter = if ENV['TRAVIS'] || ENV['COVERALLS_REPO_TOKEN']
InceptionFormatter... | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/spec/coveralls/output_spec.rb | spec/coveralls/output_spec.rb | require 'spec_helper'
describe Coveralls::Output do
it "defaults the IO to $stdout" do
old_stdout = $stdout
out = StringIO.new
$stdout = out
Coveralls::Output.puts "this is a test"
expect(out.string).to eq "this is a test\n"
$stdout = old_stdout
end
it "accepts an IO injection" do
ou... | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/spec/coveralls/configuration_spec.rb | spec/coveralls/configuration_spec.rb | require 'spec_helper'
describe Coveralls::Configuration do
before do
ENV.stub(:[]).and_return(nil)
end
describe '.configuration' do
it "returns a hash with the default keys" do
config = Coveralls::Configuration.configuration
config.should be_a(Hash)
config.keys.should include(:environm... | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/spec/coveralls/coveralls_spec.rb | spec/coveralls/coveralls_spec.rb | require 'spec_helper'
describe Coveralls do
before do
SimpleCov.stub(:start)
stub_api_post
Coveralls.testing = true
end
describe "#will_run?" do
it "checks CI environemnt variables" do
Coveralls.will_run?.should be_truthy
end
context "with CI disabled" do
before do
@... | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/spec/coveralls/simplecov_spec.rb | spec/coveralls/simplecov_spec.rb | require 'spec_helper'
describe Coveralls::SimpleCov::Formatter do
before do
stub_api_post
end
def source_fixture(filename)
File.expand_path( File.join( File.dirname( __FILE__ ), 'fixtures', filename ) )
end
let(:result) {
SimpleCov::Result.new({
source_fixture( 'sample.rb' ) ... | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/spec/coveralls/fixtures/sample.rb | spec/coveralls/fixtures/sample.rb | # Foo class
class Foo
def initialize
@foo = 'baz'
end
# :nocov:
def bar
@foo
end
# :nocov:
end
| ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/spec/coveralls/fixtures/app/vendor/vendored_gem.rb | spec/coveralls/fixtures/app/vendor/vendored_gem.rb | # this file should not be covered | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/spec/coveralls/fixtures/app/controllers/sample.rb | spec/coveralls/fixtures/app/controllers/sample.rb | # Foo class
class Foo
def initialize
@foo = 'baz'
end
# :nocov:
def bar
@foo
end
# :nocov:
end
| ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/spec/coveralls/fixtures/app/models/airplane.rb | spec/coveralls/fixtures/app/models/airplane.rb | # Foo class
class Foo
def initialize
@foo = 'baz'
end
def bar
@foo
end
end | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/spec/coveralls/fixtures/app/models/house.rb | spec/coveralls/fixtures/app/models/house.rb | # Foo class
class Foo
def initialize
@foo = 'baz'
end
def bar
@foo
end
end | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/spec/coveralls/fixtures/app/models/dog.rb | spec/coveralls/fixtures/app/models/dog.rb | # Foo class
class Foo
def initialize
@foo = 'baz'
end
def bar
@foo
end
end | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/spec/coveralls/fixtures/app/models/robot.rb | spec/coveralls/fixtures/app/models/robot.rb | # Foo class
class Foo
def initialize
@foo = 'baz'
end
def bar
@foo
end
end | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/spec/coveralls/fixtures/app/models/user.rb | spec/coveralls/fixtures/app/models/user.rb | # Foo class
class Foo
def initialize
@foo = 'baz'
end
def bar
@foo
end
end | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/lib/coveralls.rb | lib/coveralls.rb | require "coveralls/version"
require "coveralls/configuration"
require "coveralls/api"
require "coveralls/output"
require "coveralls/simplecov"
module Coveralls
extend self
class NilFormatter
def format(result)
end
end
attr_accessor :testing, :noisy, :run_locally
def wear!(simplecov_setting=nil, &b... | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/lib/coveralls/command.rb | lib/coveralls/command.rb | require "thor"
module Coveralls
class CommandLine < Thor
desc "push", "Runs your test suite and pushes the coverage results to Coveralls."
def push
return unless ensure_can_run_locally!
ENV["COVERALLS_RUN_LOCALLY"] = "true"
cmds = ["bundle exec rake"]
if File.exist?('.travis.yml')
... | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/lib/coveralls/version.rb | lib/coveralls/version.rb | module Coveralls
VERSION = "0.8.23"
end
| ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/lib/coveralls/simplecov.rb | lib/coveralls/simplecov.rb | module Coveralls
module SimpleCov
class Formatter
def display_result(result)
# Log which files would be submitted.
if result.files.length > 0
Coveralls::Output.puts "[Coveralls] Some handy coverage stats:"
else
Coveralls::Output.puts "[Coveralls] There are no cov... | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/lib/coveralls/output.rb | lib/coveralls/output.rb | module Coveralls
#
# Public: Methods for formatting strings with Term::ANSIColor.
# Does not utilize monkey-patching and should play nicely when
# included with other libraries.
#
# All methods are module methods and should be called on
# the Coveralls::Output module.
#
# Examples
#
# Coveralls:... | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/lib/coveralls/api.rb | lib/coveralls/api.rb | require 'json'
require 'net/https'
require 'tempfile'
module Coveralls
class API
if ENV['COVERALLS_ENDPOINT']
API_HOST = ENV['COVERALLS_ENDPOINT']
API_DOMAIN = ENV['COVERALLS_ENDPOINT']
else
API_HOST = ENV['COVERALLS_DEVELOPMENT'] ? "localhost:3000" : "coveralls.io"
API_PROTOCOL = ENV... | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/lib/coveralls/configuration.rb | lib/coveralls/configuration.rb | require 'yaml'
require 'securerandom'
module Coveralls
module Configuration
def self.configuration
config = {
:environment => self.relevant_env,
:git => git
}
yml = self.yaml_config
if yml
config[:configuration] = yml
config[:repo_token] = yml['repo_token'... | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
lemurheavy/coveralls-ruby | https://github.com/lemurheavy/coveralls-ruby/blob/affba6ec6c49f74a38ce98e646063a84d62f80ea/lib/coveralls/rake/task.rb | lib/coveralls/rake/task.rb | require 'rake'
require 'rake/tasklib'
module Coveralls
class RakeTask < ::Rake::TaskLib
include ::Rake::DSL if defined?(::Rake::DSL)
def initialize(*args, &task_block)
namespace :coveralls do
desc "Push latest coverage results to Coveralls.io"
task :push do
require 'coveralls... | ruby | MIT | affba6ec6c49f74a38ce98e646063a84d62f80ea | 2026-01-04T17:47:03.441275Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
if ENV["COVERAGE"] == "true"
require "simplecov"
require "coveralls"
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
])
SimpleCov.start do
command_name "spec"
add_filter "spec... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/unit/can_spec.rb | spec/unit/can_spec.rb | # frozen_string_literal: true
RSpec.describe Necromancer, "can?" do
it "checks if conversion is possible" do
converter = described_class.new
expect(converter.can?(:string, :integer)).to eq(true)
expect(converter.can?(:unknown, :integer)).to eq(false)
end
end
| ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/unit/new_spec.rb | spec/unit/new_spec.rb | # frozen_string_literal: true
RSpec.describe Necromancer, "#new" do
subject(:converter) { described_class.new }
it "creates context" do
expect(converter).to be_a(Necromancer::Context)
end
end
| ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/unit/inspect_spec.rb | spec/unit/inspect_spec.rb | # frozen_string_literal: true
RSpec.describe Necromancer, ".inspect" do
subject(:converter) { described_class.new }
it "inspects converter instance" do
expect(converter.inspect).to eq(
"#<Necromancer::Context@#{converter.object_id} " \
"@config=#{converter.configuration}>"
)
end
it "inspe... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/unit/register_spec.rb | spec/unit/register_spec.rb | # frozen_string_literal: true
RSpec.describe Necromancer, ".register" do
it "allows ro register converter" do
converter = described_class.new
stub_const("UpcaseConverter", Struct.new(:source, :target) do
def call(value, **_options)
value.to_s.upcase
end
end)
upcase_converter = Up... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/unit/convert_spec.rb | spec/unit/convert_spec.rb | # frozen_string_literal: true
RSpec.describe Necromancer, ".convert" do
subject(:converter) { described_class.new }
it "indicates inability to perform the requested conversion" do
expect {
converter.convert(:foo).to(:float)
}.to raise_error(Necromancer::NoTypeConversionAvailableError,
... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/unit/config_spec.rb | spec/unit/config_spec.rb | # frozen_string_literal: true
RSpec.describe Necromancer, "config" do
it "configures global settings per instance" do
converter = described_class.new
converter.configure do |config|
config.strict false
end
expect(converter.convert("1.2.3").to(:array)).to eq(["1.2.3"])
converter.configure ... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/unit/converters/array_spec.rb | spec/unit/converters/array_spec.rb | # frozen_string_literal: true
RSpec.describe Necromancer::ArrayConverters, "#call" do
describe ":string -> :array" do
subject(:converter) {
described_class::StringToArrayConverter.new(:string, :array)
}
{
"" => [],
"123" => %w[123],
"1,2,3" =>... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/unit/converters/range_spec.rb | spec/unit/converters/range_spec.rb | # frozen_string_literal: true
RSpec.describe Necromancer::RangeConverters, "#call" do
describe ":string -> :range" do
subject(:converter) { described_class::StringToRangeConverter.new }
{
"" => "",
"a" => "a",
"1" => 1..1,
"1.0" => 1.0..1.0,
"1..1... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/unit/converters/date_time_spec.rb | spec/unit/converters/date_time_spec.rb | # frozen_string_literal: true
RSpec.describe Necromancer::DateTimeConverters, "#call" do
describe ":string -> :date" do
subject(:converter) {
described_class::StringToDateConverter.new(:string, :date)
}
{
"" => "",
"1-1-2015" => Date.parse("2015/01/01"),
"2014/12/07" ... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/unit/converters/numeric_spec.rb | spec/unit/converters/numeric_spec.rb | # frozen_string_literal: true
RSpec.describe Necromancer::NumericConverters, "#call" do
describe ":string -> :float" do
subject(:converter) {
described_class::StringToFloatConverter.new(:string, :float)
}
{
"" => 0.0,
"1" => 1.0,
"+1" => 1.0,
"1.2a" => ... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/unit/converters/hash_spec.rb | spec/unit/converters/hash_spec.rb | # frozen_string_literal: true
RSpec.describe Necromancer::HashConverters, "#call" do
describe ":string -> :hash" do
subject(:converter) { described_class::StringToHashConverter.new }
{
"a=1" => { a: "1" },
"a=1&b=2" => { a: "1", b: "2" },
"a= & b=2" => { a: "", b... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/unit/converters/boolean_spec.rb | spec/unit/converters/boolean_spec.rb | # frozen_string_literal: true
RSpec.describe Necromancer::BooleanConverters, "#call" do
describe ":string -> :boolean" do
subject(:converter) {
described_class::StringToBooleanConverter.new(:string, :boolean)
}
it "passes through boolean value" do
expect(converter.(true)).to eq(true)
end... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/unit/conversions/register_spec.rb | spec/unit/conversions/register_spec.rb | # frozen_string_literal: true
RSpec.describe Necromancer::Conversions, ".register" do
it "allows to register converter" do
context = described_class.new
converter = double(:converter, { source: :string, target: :numeric })
expect(context.register(converter)).to eq(true)
expect(context[:string, :numer... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/unit/conversions/fetch_spec.rb | spec/unit/conversions/fetch_spec.rb | # frozen_string_literal: true
RSpec.describe Necromancer::Conversions, "#fetch" do
it "retrieves conversion given source & target" do
converter = double(:converter)
conversions = described_class.new nil, { "string->array" => converter }
expect(conversions["string", "array"]).to eq(converter)
end
it ... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/unit/conversions/to_hash_spec.rb | spec/unit/conversions/to_hash_spec.rb | # frozen_string_literal: true
RSpec.describe Necromancer::Conversions, "#to_hash" do
it "exports default conversions to hash" do
conversions = Necromancer::Conversions.new
expect(conversions.to_hash).to eq({})
conversions.load
expect(conversions.to_hash.keys.sort).to eq([
"array->array",
... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/spec/unit/configuration/new_spec.rb | spec/unit/configuration/new_spec.rb | # frozen_string_literal: true
RSpec.describe Necromancer::Configuration, ".new" do
subject(:config) { described_class.new }
it { is_expected.to respond_to(:strict=) }
it { is_expected.to respond_to(:copy=) }
it "is in non-strict mode by default" do
expect(config.strict).to eq(false)
end
it "is in c... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/lib/necromancer.rb | lib/necromancer.rb | # frozen_string_literal: true
require_relative "necromancer/context"
require_relative "necromancer/version"
module Necromancer
# Raised when cannot conver to a given type
ConversionTypeError = Class.new(StandardError)
# Raised when conversion type is not available
NoTypeConversionAvailableError = Class.new(S... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/lib/necromancer/version.rb | lib/necromancer/version.rb | # frozen_string_literal: true
module Necromancer
VERSION = "0.7.0"
end # Necromancer
| ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/lib/necromancer/converter.rb | lib/necromancer/converter.rb | # frozen_string_literal: true
require_relative "configuration"
module Necromancer
# Abstract converter used internally as a base for other converters
#
# @api private
class Converter
# Create an abstract converter
#
# @param [Object] source
# the source object type
#
# @param [Object... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/lib/necromancer/null_converter.rb | lib/necromancer/null_converter.rb | # frozen_string_literal: true
require_relative "converter"
module Necromancer
# A pass through converter
class NullConverter < Converter
def call(value, strict: config.strict)
value
end
end # NullConverter
end # Necromancer
| ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/lib/necromancer/conversions.rb | lib/necromancer/conversions.rb | # frozen_string_literal: true
require_relative "configuration"
require_relative "converter"
require_relative "converters/array"
require_relative "converters/boolean"
require_relative "converters/date_time"
require_relative "converters/hash"
require_relative "converters/numeric"
require_relative "converters/range"
mod... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/lib/necromancer/configuration.rb | lib/necromancer/configuration.rb | # frozen_string_literal: true
module Necromancer
# A global configuration for converters.
#
# Used internally by {Necromancer::Context}.
#
# @api private
class Configuration
# Configure global strict mode
#
# @api public
attr_writer :strict
# Configure global copy mode
#
# @api... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/lib/necromancer/context.rb | lib/necromancer/context.rb | # frozen_string_literal: true
require "forwardable"
require_relative "configuration"
require_relative "conversions"
require_relative "conversion_target"
module Necromancer
# A class used by Necromancer to provide user interace
#
# @api public
class Context
extend Forwardable
def_delegators :"@conver... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/lib/necromancer/conversion_target.rb | lib/necromancer/conversion_target.rb | # frozen_string_literal: true
module Necromancer
# A class responsible for wrapping conversion target
#
# @api private
class ConversionTarget
# Used as a stand in for lack of value
# @api private
UndefinedValue = Module.new
# @api private
def initialize(conversions, object)
@object =... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/lib/necromancer/converters/range.rb | lib/necromancer/converters/range.rb | # frozen_string_literal: true
require_relative "../converter"
require_relative "../null_converter"
module Necromancer
# Container for Range converter classes
module RangeConverters
SINGLE_DIGIT_MATCHER = /^(?<digit>-?\d+(\.\d+)?)$/.freeze
DIGIT_MATCHER = /^(?<open>-?\d+(\.\d+)?)
\s*... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/lib/necromancer/converters/array.rb | lib/necromancer/converters/array.rb | # frozen_string_literal: true
require "set"
require_relative "../converter"
require_relative "boolean"
require_relative "numeric"
module Necromancer
# Container for Array converter classes
module ArrayConverters
ARRAY_MATCHER = /^(.+?(\s*(?<sep>(,|-))\s*))+/x.freeze
# An object that converts a String to... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/lib/necromancer/converters/boolean.rb | lib/necromancer/converters/boolean.rb | # frozen_string_literal: true
require_relative "../converter"
require_relative "../null_converter"
module Necromancer
# Container for Boolean converter classes
module BooleanConverters
TRUE_MATCHER = /^(yes|y|on|t(rue)?|1)$/i.freeze
FALSE_MATCHER = /^(no|n|off|f(alse)?|0)$/i.freeze
# An object that ... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/lib/necromancer/converters/date_time.rb | lib/necromancer/converters/date_time.rb | # frozen_string_literal: true
require "date"
require "time"
require_relative "../converter"
require_relative "../null_converter"
module Necromancer
# Container for Date converter classes
module DateTimeConverters
# An object that converts a String to a Date
class StringToDateConverter < Converter
#... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/lib/necromancer/converters/hash.rb | lib/necromancer/converters/hash.rb | # frozen_string_literal: true
require_relative "../converter"
require_relative "boolean"
require_relative "numeric"
module Necromancer
module HashConverters
# An object that converts a String to a Hash
class StringToHashConverter < Converter
DEFAULT_CONVERSION = ->(val, *_rest) { val }
# Conver... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
piotrmurach/necromancer | https://github.com/piotrmurach/necromancer/blob/fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5/lib/necromancer/converters/numeric.rb | lib/necromancer/converters/numeric.rb | # frozen_string_literal: true
require_relative "../converter"
require_relative "../null_converter"
module Necromancer
# Container for Numeric converter classes
module NumericConverters
INTEGER_MATCHER = /^\s*[-+]?\s*(\d[\d\s]*)?$/.freeze
FLOAT_MATCHER = /^\s*[-+]?([\d\s]*)(\.[\d\s]+)?([eE]?[-+]?[\d\s]+)?... | ruby | MIT | fc815d9ca6f8e5820e4b22aa1ea0e0ad7e3f9cf5 | 2026-01-04T17:47:00.524454Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/init.rb | init.rb | require 'seer'
| ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/spec/pie_chart_spec.rb | spec/pie_chart_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Seer::PieChart" do
before :each do
@chart = Seer::PieChart.new(
:data => [0,1,2,3],
:label_method => 'to_s',
:data_method => 'size',
:chart_options => {},
:chart_element => 'chart'
)
end
des... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/spec/seer_spec.rb | spec/seer_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Seer" do
require 'rubygems'
it 'validates hexadecimal numbers' do
invalid = [nil, '', 'food', 'bdadce', 123456]
valid = ['#000000','#ffffff']
invalid.each{ |e| Seer.valid_hex_number?(e).should be_false }
valid.each { |... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/spec/column_chart_spec.rb | spec/column_chart_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Seer::ColumnChart" do
before :each do
@chart = Seer::ColumnChart.new(
:data => [0,1,2,3],
:label_method => 'to_s',
:data_method => 'size',
:chart_options => {},
:chart_element => 'chart'
)
end
... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/spec/helpers.rb | spec/helpers.rb | describe "it has colors attribute", :shared => true do
it 'sets its colors value' do
color_list = ['#7e7587','#990000','#009900', '#3e5643', '#660000', '#003300']
@chart.colors = color_list
@chart.colors.should == color_list
end
it 'colors should be an array' do
lambda {
@chart.col... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/spec/chart_spec.rb | spec/chart_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Seer::Chart" do
before :all do
@chart = Seer::AreaChart.new(
:data => [0,1,2,3],
:series_label => 'to_s',
:data_series => [[1,2,3],[3,4,5]],
:data_label => 'to_s',
:data_method => 'size',
... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/spec/gauge_spec.rb | spec/gauge_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Seer::Gauge" do
before :each do
@chart = Seer::Gauge.new(
:data => [0,1,2,3],
:label_method => 'to_s',
:data_method => 'size',
:chart_options => {},
:chart_element => 'chart'
)
end
... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/spec/bar_chart_spec.rb | spec/bar_chart_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Seer::BarChart" do
before :each do
@chart = Seer::BarChart.new(
:data => [0,1,2,3],
:label_method => 'to_s',
:data_method => 'size',
:chart_options => {},
:chart_element => 'chart'
)
end
des... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/spec/area_chart_spec.rb | spec/area_chart_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Seer::AreaChart" do
before :each do
@chart = Seer::AreaChart.new(
:data => [0,1,2,3],
:series_label => 'to_s',
:data_series => [[1,2,3],[3,4,5]],
:data_label => 'to_s',
:data_method => 'size',
... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/spec/line_chart_spec.rb | spec/line_chart_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Seer::LineChart" do
before :each do
@chart = Seer::LineChart.new(
:data => [0,1,2,3],
:series_label => 'to_s',
:data_series => [[1,2,3],[3,4,5]],
:data_label => 'to_s',
:data_method => 'size',
... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/spec/custom_matchers.rb | spec/custom_matchers.rb | module CustomMatcher
def set_cell(row, column, value)
value = "'#{value}'" if value.is_a?(String)
simple_matcher("setCell(#{row}, #{column}, #{value})") do |actual|
actual =~ /data\.setCell\(#{row},\s*#{column},\s*#{value}\)/
end
end
def set_value(row, column, value)
value = "'#{... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/spec/geomap_spec.rb | spec/geomap_spec.rb | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Seer::Geomap" do
before :each do
class GeoThing
def initialize; end
def name; 'foo'; end
def latitude; -90; end
def longitude; -90; end
def count; 8; end
def geocoded?; true; end
end
@char... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/spec/spec_helper.rb | spec/spec_helper.rb | $LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rubygems'
require 'action_pack'
require 'active_support'
require 'spec'
require 'spec/autorun'
require 'seer'
require File.dirname(__FILE__) + "/custom_matchers"
require File.dirname(__FILE__) + '/he... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/lib/seer.rb | lib/seer.rb | module Seer
require 'seer/chart'
require 'seer/area_chart'
require 'seer/bar_chart'
require 'seer/column_chart'
require 'seer/gauge'
require 'seer/geomap'
require 'seer/line_chart'
require 'seer/pie_chart'
VISUALIZERS = [:area_chart, :bar_chart, :column_chart, :gauge, :geomap, :line_chart, :pie_ch... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/lib/seer/bar_chart.rb | lib/seer/bar_chart.rb | module Seer
# =USAGE
#
# In your controller:
#
# @data = Widgets.all # Must be an array, and must respond
# # to the data method specified below (in this example, 'quantity')
#
# In your view:
#
# <div id="chart"></div>
#
# <%= Seer::visualize(
# @widgets,... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/lib/seer/chart.rb | lib/seer/chart.rb | module Seer
module Chart #:nodoc:
attr_accessor :chart_element, :colors
DEFAULT_COLORS = ['#324F69','#919E4B', '#A34D4D', '#BEC8BE']
DEFAULT_LEGEND_LOCATION = 'bottom'
DEFAULT_HEIGHT = 350
DEFAULT_WIDTH = 550
def in_element=(elem)
@chart_element = elem
end
def co... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/lib/seer/column_chart.rb | lib/seer/column_chart.rb | module Seer
# =USAGE
#
# In your controller:
#
# @data = Widgets.all # Must be an array, and must respond
# # to the data method specified below (in this example, 'quantity')
#
# In your view:
#
# <div id="chart"></div>
#
# <%= Seer::visualize(
# @widgets,... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/lib/seer/gauge.rb | lib/seer/gauge.rb | module Seer
# =USAGE
#
# In your controller:
#
# @data = Widgets.all # Must be an array, and must respond
# # to the data method specified below (in this example, 'quantity')
#
# In your view:
#
# <div id="chart"></div>
#
# <%= Seer::visualize(
# @data,... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
CoralineAda/seer | https://github.com/CoralineAda/seer/blob/2419e7a03a0cbf0c320b6cdfdcc902f6cf178709/lib/seer/line_chart.rb | lib/seer/line_chart.rb | module Seer
# =USAGE
#
# In your controller:
#
# @data = Widgets.all # Must be an array of objects that respond to the specidied data method
# # (In this example, 'quantity'
#
# @series = @data.map{|w| w.widget_stats} # An array of arrays
#
# In your view:
#
# <div i... | ruby | MIT | 2419e7a03a0cbf0c320b6cdfdcc902f6cf178709 | 2026-01-04T17:47:08.820980Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.