source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | spec/ruby-measurement/definitions/metric/length_spec.rb | Ruby | mit | 46 | master | 6,540 | # encoding: UTF-8
require 'spec_helper'
RSpec.describe Measurement do
describe 'kilometers' do
subject { described_class.parse('1 km') }
it 'converts to hectometers' do
expect(subject.convert_to(:hm).quantity).to eq 10
end
it 'converts to dekameters' do
expect(subject.convert_to(:dam).... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | spec/ruby-measurement/definitions/metric/volume_spec.rb | Ruby | mit | 46 | master | 6,540 | # encoding: UTF-8
require 'spec_helper'
RSpec.describe Measurement do
describe 'kiloliters' do
subject { described_class.parse('1 kl') }
it 'converts to hectoliters' do
expect(subject.convert_to(:hl).quantity).to eq 10
end
it 'converts to dekaliters' do
expect(subject.convert_to(:dal).... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | spec/ruby-measurement/definitions/metric/area_spec.rb | Ruby | mit | 46 | master | 1,696 | # encoding: UTF-8
require 'spec_helper'
RSpec.describe Measurement do
describe 'square kilometers' do
subject { described_class.parse('10 km²') }
it 'converts to hectares' do
expect(subject.convert_to(:ha).quantity).to eq 1_000
end
it 'converts to ares' do
expect(subject.convert_to(:a)... |
github | mhuggins/ruby-measurement | https://github.com/mhuggins/ruby-measurement | spec/ruby-measurement/definitions/metric/capacity_spec.rb | Ruby | mit | 46 | master | 996 | # encoding: UTF-8
require 'spec_helper'
RSpec.describe Measurement do
describe 'cubic meters' do
subject { described_class.parse('1 m³') }
it 'converts to cubic decimeters' do
expect(subject.convert_to(:dm3).quantity).to eq 1_000
end
it 'converts to cubic centimeters' do
expect(subject... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | parsekit.gemspec | Ruby | mit | 46 | main | 1,578 | # frozen_string_literal: true
require_relative "lib/parsekit/version"
Gem::Specification.new do |spec|
spec.name = "parsekit"
spec.version = ParseKit::VERSION
spec.authors = ["Chris Petersen"]
spec.email = ["chris@petersen.io"]
spec.summary = "Ruby document parsing toolkit with PDF and OCR support"
spec.... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | Rakefile | Ruby | mit | 46 | main | 4,879 | # frozen_string_literal: true
require "bundler/gem_tasks"
require "rake/extensiontask"
require "rspec/core/rake_task"
# RSpec test task
RSpec::Core::RakeTask.new(:spec)
# Load the gemspec
spec = Gem::Specification.load("parsekit.gemspec")
# Extension compilation task
Rake::ExtensionTask.new("parsekit", spec) do |ex... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | lib/parsekit.rb | Ruby | mit | 46 | main | 2,719 | # frozen_string_literal: true
require_relative "parsekit/version"
# Load the native extension
begin
require_relative "parsekit/parsekit"
rescue LoadError
require "parsekit/parsekit"
end
require_relative "parsekit/error"
require_relative "parsekit/parser"
# ParseKit is a Ruby document parsing toolkit with PDF an... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | lib/parsekit/error.rb | Ruby | mit | 46 | main | 463 | # frozen_string_literal: true
module ParseKit
# Error classes are defined in the native extension
# This file is kept for documentation purposes
# Base error class for ParseKit (defined in native extension)
# class Error < StandardError; end
# Raised when parsing fails (defined in native extension)
#... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | lib/parsekit/parser.rb | Ruby | mit | 46 | main | 8,431 | # frozen_string_literal: true
module ParseKit
# Ruby wrapper for the native Parser class
#
# This class provides document parsing capabilities through a native Rust extension.
# For documentation of native methods, see NATIVE_API.md
#
# The Ruby layer provides convenience methods and helpers while the Rust... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | examples/basic_parsing.rb | Ruby | mit | 46 | main | 2,232 | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'bundler/setup'
require 'parsekit'
puts "ParseKit Ruby - Basic Examples"
puts "=" * 40
# Example 1: Simple parsing
puts "\n1. Simple parsing:"
result = ParseKit.parse("Hello, World!")
puts " Input: 'Hello, World!'"
puts " Result: #{result}"
# Example 2: ... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | examples/parsekit_demo.rb | Ruby | mit | 46 | main | 2,363 | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'bundler/setup'
require 'parsekit'
puts "ParseKit Ruby - Document Parsing Demo"
puts "=" * 40
puts "This gem provides document text extraction with zero runtime dependencies."
puts ""
# Note: This requires system libraries to be installed
# See DEPENDENCIES.m... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | examples/parse_documents.rb | Ruby | mit | 46 | main | 7,078 | #!/usr/bin/env ruby
# Example script for parsing various document types with ParseKit
#
# Usage: ruby parse_documents.rb [file_path]
#
# If no file path is provided, the script will demonstrate parsing
# with sample content for various formats.
require_relative '../lib/parsekit'
require 'tempfile'
require 'json'
def... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | examples/advanced_parsing.rb | Ruby | mit | 46 | main | 4,763 | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'bundler/setup'
require 'parsekit'
require 'benchmark'
require 'json'
puts "ParseKit Ruby - Advanced Examples"
puts "=" * 40
# Example 1: Batch processing
puts "\n1. Batch processing multiple inputs:"
inputs = [
"First document to parse",
"Second document... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | spec/spec_helper.rb | Ruby | mit | 46 | main | 2,298 | # frozen_string_literal: true
# Coverage setup (must be before requiring the gem)
require "simplecov"
# Configure SimpleCov before starting
SimpleCov.configure do
# Set the root to the project directory
root File.expand_path("..", __dir__)
# Track files even if not loaded during test run
track_files "lib/*... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | spec/parsekit_spec.rb | Ruby | mit | 46 | main | 7,673 | # frozen_string_literal: true
RSpec.describe ParseKit do
it "has a version number" do
expect(ParseKit::VERSION).not_to be_nil
expect(ParseKit::VERSION).to match(/\d+\.\d+\.\d+/)
end
describe ".parse" do
it "parses a simple string" do
result = described_class.parse("test input")
expect(re... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | spec/support/shared_examples.rb | Ruby | mit | 46 | main | 1,664 | # frozen_string_literal: true
RSpec.shared_examples "a parser method" do |method_name|
it "returns a string" do
result = subject.send(method_name, valid_input)
expect(result).to be_a(String)
end
it "raises ArgumentError for empty input" do
expect { subject.send(method_name, empty_input) }.to raise_e... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | spec/parsekit/error_handling_spec.rb | Ruby | mit | 46 | main | 4,478 | RSpec.describe "ParseKit Error Handling" do
let(:parser) { ParseKit::Parser.new }
describe "corrupted file handling" do
context "with corrupted PDF files" do
it "handles corrupted PDF gracefully" do
corrupted_pdf = "spec/fixtures/corrupted.pdf"
unless File.exist?(corrupted_pdf)
... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | spec/parsekit/pdf_parser_spec.rb | Ruby | mit | 46 | main | 8,997 | # frozen_string_literal: true
RSpec.describe "PDF Parsing with MuPDF" do
let(:parser) { ParseKit::Parser.new }
describe "#parse_pdf" do
context "with valid PDF data" do
let(:simple_pdf) do
# Minimal valid PDF with "Hello World" text
# This is a hand-crafted minimal PDF
pdf_conten... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | spec/parsekit/format_detection_spec.rb | Ruby | mit | 46 | main | 12,523 | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "Format Detection" do
let(:parser) { ParseKit::Parser.new }
describe "extension-based detection" do
it "detects PDF files by extension" do
expect(ParseKit.detect_format("document.pdf")).to eq(:pdf)
expect(ParseKit.detect_format("D... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | spec/parsekit/simple_parsing_spec.rb | Ruby | mit | 46 | main | 7,172 | # frozen_string_literal: true
require 'spec_helper'
require 'tempfile'
RSpec.describe "Simple File Parsing" do
let(:parser) { ParseKit::Parser.new }
describe "text file parsing" do
it "parses text files correctly" do
Tempfile.create(['test', '.txt']) do |file|
content = "This is a test file\nWi... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | spec/parsekit/encoding_spec.rb | Ruby | mit | 46 | main | 6,082 | RSpec.describe "ParseKit Encoding Support" do
let(:parser) { ParseKit::Parser.new }
describe "different text encodings" do
context "with Latin-1 (ISO-8859-1) encoded files" do
it "handles Latin-1 encoded text files" do
latin1_file = "spec/fixtures/latin1.txt"
unless File.exist?(latin1_fil... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | spec/parsekit/dispatch_spec.rb | Ruby | mit | 46 | main | 14,637 | # frozen_string_literal: true
require "spec_helper"
require "tempfile"
RSpec.describe "Dispatch and Routing" do
let(:parser) { ParseKit::Parser.new }
describe "parse_file dispatch" do
context "with PDF files" do
it "correctly parses .pdf files" do
pdf_file = File.join(__dir__, "..", "fixtures",... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | spec/parsekit/validation_helpers_spec.rb | Ruby | mit | 46 | main | 10,770 | # frozen_string_literal: true
require "spec_helper"
require "tempfile"
require "fileutils"
RSpec.describe "ParseKit::Parser validation helpers" do
let(:parser) { ParseKit::Parser.new }
describe "#valid_input?" do
context "with valid inputs" do
it "returns true for non-empty strings" do
expect(p... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | spec/parsekit/parser_spec.rb | Ruby | mit | 46 | main | 13,067 | # frozen_string_literal: true
RSpec.describe ParseKit::Parser do
describe "#initialize" do
it "creates a parser with default options" do
parser = described_class.new
expect(parser).to be_a(described_class)
expect(parser.strict_mode?).to be false
end
it "creates a parser with custom opt... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | spec/parsekit/ocr_spec.rb | Ruby | mit | 46 | main | 6,792 | require 'spec_helper'
RSpec.describe "OCR with Tesseract" do
let(:parser) { ParseKit::Parser.new }
# Tesseract is now bundled with the gem, so OCR is always available
describe "#ocr_image" do
context "with valid image data" do
it "extracts text from PNG image" do
png_data = File.read("spec/fi... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | spec/parsekit/integration_spec.rb | Ruby | mit | 46 | main | 8,286 | # frozen_string_literal: true
RSpec.describe "ParseKit Integration" do
describe "document format support" do
let(:parser) { ParseKit::Parser.new }
context "with sample documents" do
it "extracts text from PDF files" do
pdf_file = "spec/fixtures/sample.pdf"
unless File.exist?(pdf_file)
... |
github | scientist-labs/parsekit | https://github.com/scientist-labs/parsekit | spec/parsekit/error_consistency_spec.rb | Ruby | mit | 46 | main | 11,567 | # frozen_string_literal: true
require "spec_helper"
require "tempfile"
RSpec.describe "Error Message Consistency" do
let(:parser) { ParseKit::Parser.new }
describe "OCR error messages" do
context "image loading failures" do
it "preserves error context for invalid image data" do
invalid_data = "... |
github | danoprey/depreciated-hl-cli | https://github.com/danoprey/depreciated-hl-cli | hyperledger_cli.gemspec | Ruby | mit | 46 | master | 901 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'hyperledger_cli/version'
Gem::Specification.new do |spec|
spec.name = "hyperledger_cli"
spec.version = HyperledgerCli::VERSION
spec.authors = ["Daniel Feichtinger"]
s... |
github | danoprey/depreciated-hl-cli | https://github.com/danoprey/depreciated-hl-cli | lib/hyperledger_cli.rb | Ruby | mit | 46 | master | 893 | require 'pp'
require 'json'
require 'restclient'
require 'hyperledger_cli/version'
require_relative 'hyperledger_cli/error_printer'
include HyperledgerCli::ErrorPrinter
module HyperledgerCli
def post(url, data, key = nil)
json_data = data.to_json
headers = {
content_type: :json,
accept: 'appli... |
github | danoprey/depreciated-hl-cli | https://github.com/danoprey/depreciated-hl-cli | lib/hyperledger_cli/key.rb | Ruby | mit | 46 | master | 831 | require 'openssl'
include OpenSSL
module HyperledgerCli
class Key
def initialize(public_key = nil)
@key = if public_key
PKey::EC.new(File.open(path(public_key)).read)
else
PKey::EC.new("secp256k1").generate_key
end
end
def path(public_key = nil)
root =... |
github | Inversion-des/paralines | https://github.com/Inversion-des/paralines | paralines.gemspec | Ruby | mit | 46 | master | 423 | Gem::Specification.new do |s|
s.name = 'paralines'
s.summary = 'Nice output to console/file from concurrent threads.'
s.version = '1.1.1'
s.authors = ['Yura Babak']
s.email = ['yura.des@gmail.com']
s.homepage = 'https://github.com/Inversion-des/paralines'
s.license = 'MIT'
s.files = %w[lib/paralines.rb README.m... |
github | Inversion-des/paralines | https://github.com/Inversion-des/paralines | lib/paralines.rb | Ruby | mit | 46 | master | 3,558 | # *frozen_string_literal: true — should not be used here to ensure unique object_id for ''
class ParaLines
def initialize
set_flags!
@line_by_key = Hash.new {|h, key| h[key] = {line:h.length, col:1, text:''.freeze} }
# *ensure flush at exit
if @f_to_file
at_exit do
flush
end
end
if block_give... |
github | Inversion-des/paralines | https://github.com/Inversion-des/paralines | spec/main_sample.rb | Ruby | mit | 46 | master | 1,374 | require_relative '../lib/paralines'
puts '- start -'
ParaLines.new do |plines|
odd_line = plines.add_shared_line 'Odd: '
even_line = plines.add_shared_line 'Even: '
done_order_line = plines.add_shared_line 'Done order: '
workers = (0..9).map do |n|
Thread.new do
if n == 0
# special case with sub-tasks... |
github | Inversion-des/paralines | https://github.com/Inversion-des/paralines | spec/paralines_spec.rb | Ruby | mit | 46 | master | 1,241 | require 'paralines'
describe ParaLines do
context 'main_sample.rb' do
def normalize_output(text)
text
.gsub(/\d/, 'N')
.gsub(/ +$/, '') # remove some spaces at line ends
end
let :expected_output do
<<~OUT
- start -
Odd: N+ N+ N+ N+ N+
Even: [N][N][N][N]
Done order: NNNNNNNNN
... |
github | logstash-plugins/logstash-input-kinesis | https://github.com/logstash-plugins/logstash-input-kinesis | logstash-input-kinesis.gemspec | Ruby | apache-2.0 | 46 | main | 1,699 | # coding: utf-8
version = File.read(File.expand_path(File.join(File.dirname(__FILE__), "VERSION"))).strip
Gem::Specification.new do |spec|
spec.name = "logstash-input-kinesis"
spec.version = version
spec.authors = ["Brian Palmer"]
spec.email = ["brian@codekitchen.net"]
spec.summa... |
github | logstash-plugins/logstash-input-kinesis | https://github.com/logstash-plugins/logstash-input-kinesis | Rakefile | Ruby | apache-2.0 | 46 | main | 556 | require "bundler/gem_tasks"
require 'jars/version'
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError
end
task default: "spec"
require 'jars/installer'
desc 'Install the JAR dependencies to vendor/'
task :install_jars do
# We actually want jar-dependencies will download the ... |
github | logstash-plugins/logstash-input-kinesis | https://github.com/logstash-plugins/logstash-input-kinesis | spec/spec_helper.rb | Ruby | apache-2.0 | 46 | main | 431 | RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.disable_monkey_patching!
config.warnings = false
if config.files_... |
github | logstash-plugins/logstash-input-kinesis | https://github.com/logstash-plugins/logstash-input-kinesis | spec/inputs/kinesis_spec.rb | Ruby | apache-2.0 | 46 | main | 10,531 | require "logstash/plugin"
require "logstash/inputs/kinesis"
require "logstash/codecs/json"
RSpec.describe "inputs/kinesis" do
KCL = com.amazonaws.services.kinesis.clientlibrary.lib.worker
let(:config) {{
"application_name" => "my-processor",
"kinesis_stream_name" => "run-specs",
"codec" => codec,
... |
github | logstash-plugins/logstash-input-kinesis | https://github.com/logstash-plugins/logstash-input-kinesis | spec/inputs/kinesis/worker_spec.rb | Ruby | apache-2.0 | 46 | main | 5,290 | require 'logstash-core/logstash-core'
require 'logstash-input-kinesis_jars'
require "logstash/plugin"
require "logstash/inputs/kinesis"
require "logstash/codecs/json"
require "json"
RSpec.describe "LogStash::Inputs::Kinesis::Worker" do
KCL_TYPES = com.amazonaws.services.kinesis.clientlibrary.types
subject!(:worke... |
github | logstash-plugins/logstash-input-kinesis | https://github.com/logstash-plugins/logstash-input-kinesis | lib/logstash/inputs/kinesis.rb | Ruby | apache-2.0 | 46 | main | 7,555 | # encoding: utf-8
require "socket"
require "uri"
require "logstash/inputs/base"
require "logstash/errors"
require "logstash/environment"
require "logstash/namespace"
require 'logstash-input-kinesis_jars'
# Receive events through an AWS Kinesis stream.
#
# This input plugin uses the Java Kinesis Client Library under... |
github | logstash-plugins/logstash-input-kinesis | https://github.com/logstash-plugins/logstash-input-kinesis | lib/logstash/inputs/kinesis/worker.rb | Ruby | apache-2.0 | 46 | main | 1,918 | # encoding: utf-8
class LogStash::Inputs::Kinesis::Worker
include com.amazonaws.services.kinesis.clientlibrary.interfaces.v2::IRecordProcessor
attr_reader(
:checkpoint_interval,
:codec,
:decorator,
:logger,
:output_queue,
)
def initialize(*args)
# nasty hack, because this is the name o... |
github | kciter/vimgolf-finder | https://github.com/kciter/vimgolf-finder | vimgolf-finder.gemspec | Ruby | mit | 47 | master | 855 | $LOAD_PATH.push File.expand_path('../lib', __FILE__)
require 'vimgolf_finder/version'
Gem::Specification.new do |s|
s.name = 'vimgolf-finder'
s.version = VimGolfFinder::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ['Lee Sun-Hyoup']
s.email = ['kciter@naver.com']
s.homepage = 'https://github.com/kc... |
github | kciter/vimgolf-finder | https://github.com/kciter/vimgolf-finder | lib/vimgolf_finder/parser.rb | Ruby | mit | 47 | master | 1,188 | module VimGolfFinder
class Parser
BASE_URL = 'http://vimgolf.com'
def fetch_challenges
challenges = []
doc = Nokogiri::HTML(URI.open(BASE_URL))
doc.css('.grid_7 > div').each do |div|
challengeDOM = div.at_css('h5.challenge')
aTAG = challengeDOM.at_css('a')
challenge... |
github | kciter/vimgolf-finder | https://github.com/kciter/vimgolf-finder | lib/vimgolf_finder/challenge.rb | Ruby | mit | 47 | master | 1,570 | module VimGolfFinder
class Challenge
attr_accessor :id, :title, :entries
attr_accessor :description
attr_accessor :start_file, :end_file, :view_diff
def print(index = 1)
if self.solved?
VimGolfFinder.ui.log "#{index}. \e[37m#{self.title}\e[0m - #{self.entries} entries (\e[33m#{self.id}\... |
github | kciter/vimgolf-finder | https://github.com/kciter/vimgolf-finder | lib/vimgolf_finder/ui.rb | Ruby | mit | 47 | master | 441 | module VimGolfFinder
class CLI < Thor
class UI < Thor::Base.shell
def initialize
super
end
def error(message)
say message, :red
end
def info(message)
say message, :green
end
def warn(message)
say message, :yellow
end
def log... |
github | kciter/vimgolf-finder | https://github.com/kciter/vimgolf-finder | lib/vimgolf_finder/cli.rb | Ruby | mit | 47 | master | 3,919 | module VimGolfFinder
class << self
attr_accessor :ui
attr_accessor :parser
def ui
@ui ||= VimGolfFinder::CLI::UI.new
end
def parser
@parser ||= VimGolfFinder::Parser.new
end
end
class CLI < Thor
include Thor::Actions
def self.start(*)
Thor::Base.shell = VimGol... |
github | jvillarejo/embedded | https://github.com/jvillarejo/embedded | embedded.gemspec | Ruby | mit | 46 | master | 908 | $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "embedded/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "embedded"
s.version = Embedded::VERSION
s.authors = ["jvillarejo"]
s.email = ["arzivian87@gmail.... |
github | jvillarejo/embedded | https://github.com/jvillarejo/embedded | Gemfile | Ruby | mit | 46 | master | 319 | source 'https://rubygems.org'
activerecord_version = ENV["ACTIVE_RECORD_VERSION"] || "default"
activerecord = case activerecord_version
when "default"
">= 3.2"
else
"~> #{activerecord_version}"
end
gem "activerecord", activerecord
gemspec |
github | jvillarejo/embedded | https://github.com/jvillarejo/embedded | lib/embedded/model.rb | Ruby | mit | 46 | master | 1,569 | module Embedded
module Model
ScopeMethod = ActiveRecord::VERSION::MAJOR >= 4 ? :all.freeze : :scoped.freeze
def embedded_column_names(embeddable_attr, attributes)
if attributes.is_a?(Array)
attributes.inject({}) do |hash, a|
hash.merge(:"#{embeddable_attr}_#{a}" => a)
end
... |
github | jvillarejo/embedded | https://github.com/jvillarejo/embedded | lib/embedded/scope.rb | Ruby | mit | 46 | master | 993 | module Embedded
class Scope
def initialize(scope,attributes)
@attributes = attributes
@scope = scope
end
def embedded_attributes_for(embeddable_attr, value = nil)
attrs = @attributes[embeddable_attr][:attrs]
if attrs.is_a?(Array)
attrs.inject({}) do |a,attr|
a.m... |
github | jvillarejo/embedded | https://github.com/jvillarejo/embedded | test/embedded_test.rb | Ruby | mit | 46 | master | 6,765 | require 'test_helper'
class Embedded::Test < Minitest::Test
def setup
end
def teardown
Reservation.destroy_all
Order.destroy_all
end
def test_embedded_column_names
hash = Reservation.embedded_column_names(:time_interval, [:start_time, :end_time])
assert_equal({
time_interval_start_t... |
github | jvillarejo/embedded | https://github.com/jvillarejo/embedded | test/test_helper.rb | Ruby | mit | 46 | master | 316 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'minitest/autorun'
require 'active_record'
require 'embedded'
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
load File.dirname(__FILE__) + '/support/schema.rb'
require File.dirname(__FILE__) + '/support/models.rb' |
github | jvillarejo/embedded | https://github.com/jvillarejo/embedded | test/support/models.rb | Ruby | mit | 46 | master | 1,910 | class TimeInterval
attr_reader :start_time, :end_time
def initialize(values={})
@start_time = values.fetch(:start_time)
@end_time = values.fetch(:end_time)
end
def ==(other)
return false if other.nil?
@start_time.utc.round == other.start_time.utc.round &&
@end_time.utc.round == other.end_... |
github | jvillarejo/embedded | https://github.com/jvillarejo/embedded | test/support/schema.rb | Ruby | mit | 46 | master | 1,372 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... |
github | kshnurov/mandrill_dm | https://github.com/kshnurov/mandrill_dm | mandrill_dm.gemspec | Ruby | mit | 46 | master | 1,005 | Gem::Specification.new do |s|
s.name = 'mandrill_dm'
s.version = '1.3.10'
s.date = '2020-03-20'
s.summary = 'A basic Mandrill delivery method for Rails.'
s.description = 'A basic Mandrill delivery method for Rails.'
s.authors = ['Jonathan Berglund', 'John Dell', 'Kirill Shnurov']
s.email = ['jonathan.berg... |
github | kshnurov/mandrill_dm | https://github.com/kshnurov/mandrill_dm | Rakefile | Ruby | mit | 46 | master | 883 | require 'bundler'
require 'bundler/gem_tasks'
Bundler.require(:default, :development)
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new
require 'rubocop/rake_task'
RuboCop::RakeTask.new
task default: %w[all_checks]
desc 'Run all specs and rubocop checks'
task :all_checks do
Rake::Task['spec'].invoke
Rake... |
github | kshnurov/mandrill_dm | https://github.com/kshnurov/mandrill_dm | lib/mandrill_dm.rb | Ruby | mit | 46 | master | 1,017 | require 'mandrill'
require 'date'
require_relative 'mandrill_dm/message'
require_relative 'mandrill_dm/delivery_method'
require_relative 'mandrill_dm/railtie' if defined? Rails
module MandrillDm
class << self
attr_accessor :configuration
end
# Call this method to modify defaults in your initializers.
#
... |
github | kshnurov/mandrill_dm | https://github.com/kshnurov/mandrill_dm | lib/mandrill_dm/delivery_method.rb | Ruby | mit | 46 | master | 1,352 | module MandrillDm
class DeliveryMethod
attr_accessor :settings, :response
def initialize(options = {})
@settings = {
api_key: MandrillDm.configuration.api_key
}.merge!(options)
end
# rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def deliver!(mail)... |
github | kshnurov/mandrill_dm | https://github.com/kshnurov/mandrill_dm | lib/mandrill_dm/message.rb | Ruby | mit | 46 | master | 6,425 | require 'base64'
module MandrillDm
class Message # rubocop:disable ClassLength
attr_reader :mail
def initialize(mail)
@mail = mail
end
# Returns a Mandrill API compatible attachment hash
def attachments
regular_attachments = mail.attachments.reject(&:inline?)
regular_attachmen... |
github | kshnurov/mandrill_dm | https://github.com/kshnurov/mandrill_dm | lib/mandrill_dm/railtie.rb | Ruby | mit | 46 | master | 286 | require 'mandrill_dm'
module MandrillDm
class Railtie < Rails::Railtie
initializer 'mandrill_dm.add_delivery_method' do
ActiveSupport.on_load :action_mailer do
ActionMailer::Base.add_delivery_method :mandrill, MandrillDm::DeliveryMethod
end
end
end
end |
github | kshnurov/mandrill_dm | https://github.com/kshnurov/mandrill_dm | spec/spec_helper.rb | Ruby | mit | 46 | master | 666 | require 'simplecov'
if ENV['COVERAGE']
SimpleCov.start do
coverage_dir 'tmp/coverage'
add_filter '/spec/'
SimpleCov.at_exit do
SimpleCov.result.format!
system('open tmp/coverage/index.html') if RUBY_PLATFORM['darwin']
end
end
end
require 'rubygems'
require 'bundler/setup'
Bundler.requ... |
github | kshnurov/mandrill_dm | https://github.com/kshnurov/mandrill_dm | spec/mandrill_dm/delivery_method_integration_spec.rb | Ruby | mit | 46 | master | 3,033 | require 'spec_helper'
describe MandrillDm::DeliveryMethod, 'integrating with the Mail API', integration: true do
before(:each) do
Mail.defaults { delivery_method MandrillDm::DeliveryMethod }
end
context '#deliver' do
let(:from_name) { 'From Name' }
let(:from_email) { 'from@domain.tld' }
... |
github | kshnurov/mandrill_dm | https://github.com/kshnurov/mandrill_dm | spec/mandrill_dm/delivery_method_spec.rb | Ruby | mit | 46 | master | 4,984 | require 'spec_helper'
describe MandrillDm::DeliveryMethod do
let(:api_key) { 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' }
subject(:delivery_method) { MandrillDm::DeliveryMethod.new }
before do
allow(MandrillDm).to receive_message_chain(
:configuration,
:api_key
).and_return(api_key)
end
context '#ini... |
github | kshnurov/mandrill_dm | https://github.com/kshnurov/mandrill_dm | spec/mandrill_dm/message_spec.rb | Ruby | mit | 46 | master | 22,499 | require 'spec_helper'
describe MandrillDm::Message do
def new_mail(options = {}, &blk)
Mail.new(options, &blk)
end
describe '#attachments' do
it 'takes an attachment' do
mail = new_mail(to: 'name@domain.tld', content_type: 'multipart/alternative')
mail.attachments['text.txt'] = {
mim... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | Gemfile | Ruby | bsd-3-clause | 46 | master | 294 | source :rubygems
group :development do
gem "bundler", "~> 1.0.0"
gem "jeweler"
gem "BlueCloth", "= 1.0.1"
gem "yard"
gem "mongrel", ">= 1.1.5"
gem "sinatra", ">= 1.1"
gem "rr"
gem "clipboard"
gem "rspec", "~> 2.6.0"
gem "ci_reporter"
gem "deprecated"
gem "builder"
end |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | operawatir.gemspec | Ruby | bsd-3-clause | 46 | master | 15,819 | # Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{operawatir}
s.version = "0.6.pre1"
s.platform = %q{jruby}
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1")... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | Rakefile | Ruby | bsd-3-clause | 46 | master | 1,960 | # -*- coding: utf-8 -*-
require 'rake/clean'
require 'jeweler'
require 'rspec/core/rake_task'
require 'yard'
require 'ci/reporter/rake/rspec'
require './lib/operawatir/version'
Jeweler::Tasks.new do |gem|
gem.name = 'operawatir'
gem.version = OperaWatir.version
gem.date = Date.today.to_s
gem.authors ... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir.rb | Ruby | bsd-3-clause | 46 | master | 2,498 | $LOAD_PATH.unshift File.expand_path('..', __FILE__)
require 'forwardable'
require 'deprecated'
require 'java'
include Java
%w(commons-jxpath-1.3.jar commons-exec-1.1.jar protobuf-java-2.4.1.jar
selenium-java-2.13.0.jar operalaunchers-0.3.jar operadriver-v0.8.1.jar
guava-10.0.1.jar).each { |jar| require "operad... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/platform.rb | Ruby | bsd-3-clause | 46 | master | 441 | require 'rbconfig'
class OperaWatir::Platform
def self.os
@os ||= (
host_os = RbConfig::CONFIG['host_os']
case host_os
when /mswin|msys|mingw|bccwin|wince|emc/
:windows
when /darwin|mac os/
:macosx
when /linux/
:linux
when /solaris|bsd/
:unix
... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/desktop_enums.rb | Ruby | bsd-3-clause | 46 | master | 1,737 | module OperaWatir
# @private
# Documentation doesn't work with these dynamic enums so just leave them out
module DesktopEnums
# Enum for the key/mouse modifiers
KEYMODIFIER_ENUM_MAP = SystemInputProtos::ModifierPressed.constants.inject({}) do |acc, const|
acc[const.to_s.downcase.to_sym] = SystemInp... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/version.rb | Ruby | bsd-3-clause | 46 | master | 339 | module OperaWatir
# @private
VERSION = File.read(File.join(File.dirname(__FILE__), '../..', 'VERSION')).strip.freeze
#
# Fetches OperaWatir's version number. Note that this is not the same
# as OperaDriver's version number.
#
# @return [String] Current version of OperaWatir.
#
def self.version
... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/compat.rb | Ruby | bsd-3-clause | 46 | master | 770 | module OperaWatir
module Compat; end
# Switches on compatibility layer (Watir 2 API).
def self.compatibility!
require 'operawatir/compat/browser'
require 'operawatir/compat/element_finders'
require 'operawatir/compat/window'
Browser.send :include, Compat::Browser
Window.send :include, Compa... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/desktop_container.rb | Ruby | bsd-3-clause | 46 | master | 14,639 | module OperaWatir
module DesktopContainer
######################################################################
# Method for accessing a button element
#
# @example
# browser.quick_button(:name, "button_OK")
#
# @param [String] how Method to find the element. :name, :text or :string_... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/window.rb | Ruby | bsd-3-clause | 46 | master | 5,088 | class OperaWatir::Window
include Deprecated
attr_accessor :browser
# Creates a new window in the browser. Note that Opera does not
# differentiate between windows and tabs. To directly create a
# _Window_ object, pass in the _Browser_.
#
# @example
# window = browser.url = 'http://example.org/'
... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/spatnav.rb | Ruby | bsd-3-clause | 46 | master | 561 | # -*- coding: utf-8 -*-
class OperaWatir::Spatnav
attr_accessor :browser
def initialize(browser)
self.browser = browser
end
# FIXME: These should be implemented as proper methods in
# OperaDriver.
def up
driver.operaAction('Navigate up')
end
def down
driver.operaAction('Navigate down')
... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/desktop_common.rb | Ruby | bsd-3-clause | 46 | master | 4,894 | module OperaWatir
# @private
# This module is to share functions in the driver between modules so
# should not be in the documentation
module DesktopCommon
include DesktopEnums
private
def widgets(window)
# If window specifies window name, and the active window has this name
# use it... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/desktop_helper.rb | Ruby | bsd-3-clause | 46 | master | 2,422 | # -*- coding: utf-8 -*-
# TODO
# You need to set the OPERA_LAUNCHER and OPERA_PATH environment variables
# for this Helper to work.
require 'operawatir'
require 'rspec'
require 'rbconfig'
require File.expand_path('../../../spec/operawatir/matchers', __FILE__)
module OperaWatir::DesktopHelper
extend self
@@f... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/exceptions.rb | Ruby | bsd-3-clause | 46 | master | 1,387 | module OperaWatir::Exceptions
# Superclass for all OperaWatir exceptions.
#
# @example
# begin
# ...
# rescue OperaWatirException
# end
class OperaWatirException < RuntimeError; end
# Raised when a method is called on an object which doesn't have a
# corresponding element.
class Unknow... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/utils.rb | Ruby | bsd-3-clause | 46 | master | 357 | class OperaWatir::Utils
def initialize(browser)
@utils = browser.driver.utils
end
def core_version
@utils.getCoreVersion
end
def os
@utils.getOS
end
def product
@utils.getProduct
end
def binary_path
@utils.getBinaryPath
end
def user_agent
@utils.getUserAgent
end
... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/keys.rb | Ruby | bsd-3-clause | 46 | master | 2,781 | # -*- coding: utf-8 -*-
class OperaWatir::Keys
attr_accessor :browser
def initialize(browser)
self.browser = browser
end
#
# Holds down supplied arbitrary list of keys indefinitely.
#
# @param [Symbol, String] *args Arbitrary list of symbols (modification)
# keys o... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/browser.rb | Ruby | bsd-3-clause | 46 | master | 6,000 | # -*- coding: utf-8 -*-
class OperaWatir::Browser
include Deprecated
attr_accessor :driver, :active_window, :preferences, :keys, :spatnav, :utils
def self.settings=(settings={})
@desired_capabilities = nil # Bust cache
@settings = settings
end
def self.settings
@settings || self.settings = {}
... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/collection.rb | Ruby | bsd-3-clause | 46 | master | 2,894 | require 'forwardable'
require 'set'
class OperaWatir::Collection
extend Forwardable
include Enumerable
attr_accessor :parent, :selector
def initialize(parent, elms=nil)
self.parent, self.selector = parent, OperaWatir::Selector.new(self)
@_elms = elms
end
def add_selector_from_arguments(args)
... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/clickable_item.rb | Ruby | bsd-3-clause | 46 | master | 2,057 | module OperaWatir
module ClickableItem
######################################################################
# Clicks the button, and waits for loading to finish
#
# @return [int] Window ID of the window shown or 0 if no window is shown
#
# @raise [DesktopExceptions::WidgetNotVisibleExceptio... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/selector.rb | Ruby | bsd-3-clause | 46 | master | 2,610 | class OperaWatir::Selector
BASE_TYPES = [:id, :class_name, :tag_name, :css, :xpath, :name]
COLLECTION_TYPES = [:index, :attribute]
META_TYPES = [:join, :antijoin]
TYPES = BASE_TYPES + COLLECTION_TYPES + META_TYPES
attr_accessor :collection, :sexp
def initialize(collection, sexp=nil)
self.... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/helper.rb | Ruby | bsd-3-clause | 46 | master | 996 | # -*- coding: utf-8 -*-
# TODO
# You need to set the OPERA_LAUNCHER and OPERA_PATH environment variables
# for this Helper to work.
require 'operawatir'
require 'rspec'
require 'rbconfig'
module OperaWatir::Helper
extend self
def settings
OperaWatir::Browser.settings
end
def browser
@browser ||... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/element.rb | Ruby | bsd-3-clause | 46 | master | 5,411 | class OperaWatir::Element
extend Forwardable
def initialize(node)
self.node = node
end
# TODO Need support for this in Webdriver
def hash
node.hashCode
end
def ==(other)
node.equals other.node
end
def eql?(other)
is_a?(other.class) && self == other
end
def hash
node.hashCo... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/screenshot.rb | Ruby | bsd-3-clause | 46 | master | 963 | class OperaWatir::Screenshot
attr_accessor :browser, :reply
def initialize(parent)
self.browser = parent.browser
self.reply = driver.saveScreenshot(2, [].to_java(:string))
end
# Saves screenshot to specified location.
#
# @param [String] Path to where you want the screenshot saved.
# @return... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/quickwidgets.rb | Ruby | bsd-3-clause | 46 | master | 402 | %w(quick_widget quick_button quick_checkbox quick_editfield
quick_dropdown quick_dialogtab quick_label quick_radiobutton quick_treeview quick_addressfield
quick_searchfield quick_toolbar quick_window quick_tab quick_treeitem quick_thumbnail
quick_find quick_griditem quick_gridlayout quick_menu quick_menuite... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/desktop_browser.rb | Ruby | bsd-3-clause | 46 | master | 27,970 | # -*- coding: utf-8 -*-
module OperaWatir
class DesktopBrowser < Browser
include DesktopContainer
include DesktopCommon
ConditionTimeout = 10.0
LoadActions = ["Open url in new page", "Open url in current page", "Open url in new background page",
"Open url in new window", "New private page", "P... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/actions.rb | Ruby | bsd-3-clause | 46 | master | 2,465 | include_class org.openqa.selenium.interactions.Actions
#include_class java.util.lang.CharSequence
class OperaWatir::Actions
attr_accessor :browser
attr_accessor :driver
attr_accessor :actions
def initialize(browser)
self.browser, self.driver = browser, browser.driver
self.actions = Java::OrgOpenqaSel... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/desktop_exceptions.rb | Ruby | bsd-3-clause | 46 | master | 434 | module OperaWatir::DesktopExceptions
include OperaWatir::Exceptions
# @example
# begin
# ...
# rescue OperaWatirException
# end
# Raised when a method is called on a control that is not visible
# corresponding element.
class WidgetNotVisibleException < OperaWatirException; end
class Unsu... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/preferences.rb | Ruby | bsd-3-clause | 46 | master | 9,867 | # -*- coding: utf-8 -*-
class String
#
# Translates an Opera preferences key string into a Ruby method name.
# It will remove tabs and spaces at beginning of string, replace
# further spaces with an underscore and make the string lower-case.
#
# The method extends the String object and can be called as a r... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/quickwidgets/quick_tab.rb | Ruby | bsd-3-clause | 46 | master | 2,505 | module OperaWatir
class QuickTab < QuickButton
# @private
# Checks the type of the widget is correct
def correct_type?
@element.getType == WIDGET_ENUM_MAP[:tabbutton]
end
######################################################################
# Drag and drop this tab on tab tab_target
... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/quickwidgets/quick_window.rb | Ruby | bsd-3-clause | 46 | master | 6,443 | module OperaWatir
class QuickWindow
include DesktopCommon
include DesktopContainer
# @private
def initialize(container, method, selector=nil)
@container = container
if method.is_a? Java::ComOperaCoreSystems::QuickWindow
@elm = method
else
@method = method
... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/quickwidgets/quick_menu.rb | Ruby | bsd-3-clause | 46 | master | 4,205 | module OperaWatir
class QuickMenu < QuickWidget #??
# @private
# Checks the type of the widget is correct
#def correct_type?
# @element.getType == WIDGET_ENUM_MAP[:menu]
#end
# @private
# window_id is set if constructor is called on a (parent) window
# location if set is this is call... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/quickwidgets/quick_dropdown.rb | Ruby | bsd-3-clause | 46 | master | 1,509 | module OperaWatir
class QuickDropdown < QuickEditField #QuickWidget
# @private
# Checks the type of the widget is correct
def correct_type?
@element.getType == WIDGET_ENUM_MAP[:dropdown]
end
######################################################################
# Checks if the item sel... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/quickwidgets/quick_menuitem.rb | Ruby | bsd-3-clause | 46 | master | 11,292 | module OperaWatir
class QuickMenuItem < QuickWidget #
# @private
# Checks the type of the widget is correct
#def correct_type?
# @element.getType == WIDGET_ENUM_MAP[:menuitem]
#end
# @private
# window_id is set if constructor is called on a (parent) window
# location is set is this i... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/quickwidgets/quick_toolbar.rb | Ruby | bsd-3-clause | 46 | master | 209 | module OperaWatir
class QuickToolbar < QuickWidget
# @private
# Checks the type of the widget is correct
def correct_type?
@element.getType == WIDGET_ENUM_MAP[:toolbar]
end
end
end |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/quickwidgets/quick_dropdownitem.rb | Ruby | bsd-3-clause | 46 | master | 1,269 | module OperaWatir
class QuickDropdownItem < QuickEditField #QuickWidget # QuickEditField?
# @private
# Checks the type of the widget is correct
def correct_type?
@element.getType == WIDGET_ENUM_MAP[:dropdownitem]
end
######################################################################
... |
github | operasoftware/operawatir | https://github.com/operasoftware/operawatir | lib/operawatir/quickwidgets/quick_addressfield.rb | Ruby | bsd-3-clause | 46 | master | 1,584 | module OperaWatir
class QuickAddressField < QuickEditField
# Checks the type of the widget is correct
#
# @private
def correct_type?
@element.getType == WIDGET_ENUM_MAP[:addressfield]
end
# Enters the url into the address field, and waits for page loading
# to finish
#
# @e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.