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 | sensu/sensu-chef | https://github.com/sensu/sensu-chef | attributes/default.rb | Ruby | apache-2.0 | 219 | develop | 2,799 | # user
default["sensu"]["user"] = "sensu"
default["sensu"]["group"] = "sensu"
# platform
if platform_family?("windows")
default["sensu"]["admin_user"] = "Administrator"
default["sensu"]["directory"] = 'C:\etc\sensu'
default["sensu"]["log_directory"] = 'C:\var\log\sensu'
default["sensu"]["windows"]["package_opt... |
github | sensu/sensu-chef | https://github.com/sensu/sensu-chef | definitions/silence_check.rb | Ruby | apache-2.0 | 219 | develop | 612 | define :sensu_silence_check, :action => :create, :expire => nil, :payload => {} do
if params[:client].nil?
params[:client] = node.name
end
if params[:action] == :create or params[:action] == :silence
sensu_api_stash "silence/#{params[:client]}/#{params[:name]}" do
api_uri params[:api_uri]
ex... |
github | sensu/sensu-chef | https://github.com/sensu/sensu-chef | definitions/silence_client.rb | Ruby | apache-2.0 | 219 | develop | 509 | define :sensu_silence_client, :action => :create, :expire => nil, :payload => {} do
if params[:action] == :create or params[:action] == :silence
sensu_api_stash "silence/#{params[:name]}" do
api_uri params[:api_uri]
expire params[:expire]
payload params[:payload]
action :create
end
e... |
github | sensu/sensu-chef | https://github.com/sensu/sensu-chef | definitions/rabbitmq_credentials.rb | Ruby | apache-2.0 | 219 | develop | 472 | define :rabbitmq_credentials do
unless get_sensu_state(node, :rabbitmq_credentials, params[:vhost], params[:user])
rabbitmq_vhost params[:vhost] do
action :add
end
rabbitmq_user params[:user] do
password params[:password]
vhost params[:vhost]
permissions params[:permissions] || ".... |
github | pixielabs/letsencrypt-rails-heroku | https://github.com/pixielabs/letsencrypt-rails-heroku | Gemfile | Ruby | mit | 219 | master | 251 | source "https://rubygems.org"
gem 'acme-client', '~> 2.0'
gem 'platform-api', '>= 2.2', '< 4'
group :development do
gem "shoulda", ">= 0"
gem "rdoc", "~> 3.12"
gem "bundler", "~> 1.0"
gem "juwelier", "~> 2.1.0"
gem "simplecov", ">= 0"
end |
github | pixielabs/letsencrypt-rails-heroku | https://github.com/pixielabs/letsencrypt-rails-heroku | letsencrypt-rails-heroku.gemspec | Ruby | mit | 219 | master | 2,978 | # Generated by juwelier
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
# stub: letsencrypt-rails-heroku 2.0.3 ruby lib
Gem::Specification.new do |s|
s.name = "letsencrypt-rails-heroku".freeze
s.version = "2.0.3"
s.required_rubygems_... |
github | pixielabs/letsencrypt-rails-heroku | https://github.com/pixielabs/letsencrypt-rails-heroku | Rakefile | Ruby | mit | 219 | master | 1,522 | # encoding: utf-8
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'
require 'juwelier'
Juwelier::Tasks.new do |gem|
# gem ... |
github | pixielabs/letsencrypt-rails-heroku | https://github.com/pixielabs/letsencrypt-rails-heroku | lib/letsencrypt-rails-heroku.rb | Ruby | mit | 219 | master | 208 | require 'letsencrypt-rails-heroku/letsencrypt'
require 'letsencrypt-rails-heroku/middleware'
require 'letsencrypt-rails-heroku/exceptions'
if defined?(Rails)
require 'letsencrypt-rails-heroku/railtie'
end |
github | pixielabs/letsencrypt-rails-heroku | https://github.com/pixielabs/letsencrypt-rails-heroku | lib/letsencrypt-rails-heroku/exceptions.rb | Ruby | mit | 219 | master | 786 | module Letsencrypt
module Error
# LetsEncrypt encountered an issue verifying the challenge.
class VerificationError < StandardError; end
# LetsEncrypt encountered an issue finalizing the order.
class FinalizationError < StandardError; end
# Challenge URL is not available.
class ChallengeUrlErr... |
github | pixielabs/letsencrypt-rails-heroku | https://github.com/pixielabs/letsencrypt-rails-heroku | lib/letsencrypt-rails-heroku/letsencrypt.rb | Ruby | mit | 219 | master | 1,496 | module Letsencrypt
class << self
attr_accessor :configuration
end
def self.configure
self.configuration ||= Configuration.new
yield(configuration) if block_given?
end
def self.challenge_configured?
configuration.acme_challenge_filename &&
configuration.acme_challenge_filename.start_wi... |
github | pixielabs/letsencrypt-rails-heroku | https://github.com/pixielabs/letsencrypt-rails-heroku | lib/letsencrypt-rails-heroku/middleware.rb | Ruby | mit | 219 | master | 392 | module Letsencrypt
class Middleware
def initialize(app)
@app = app
end
def call(env)
if Letsencrypt.challenge_configured? && env["PATH_INFO"] == "/#{Letsencrypt.configuration.acme_challenge_filename}"
return [200, {"Content-Type" => "text/plain"}, [Letsencrypt.configuration.acme_chal... |
github | pixielabs/letsencrypt-rails-heroku | https://github.com/pixielabs/letsencrypt-rails-heroku | lib/tasks/letsencrypt.rake | Ruby | mit | 219 | master | 7,708 | require 'open-uri'
require 'openssl'
require 'acme-client'
require 'platform-api'
namespace :letsencrypt do
desc 'Renew your LetsEncrypt certificate'
task :renew do
# Check configuration looks OK
abort "letsencrypt-rails-heroku is configured incorrectly. Are you missing an environment variable or other co... |
github | felixbuenemann/xlsxtream | https://github.com/felixbuenemann/xlsxtream | xlsxtream.gemspec | Ruby | mit | 219 | master | 1,236 | # frozen_string_literal: true
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'xlsxtream/version'
Gem::Specification.new do |spec|
spec.name = "xlsxtream"
spec.version = Xlsxtream::VERSION
spec.authors = ["Felix Bünemann"]
spec.ema... |
github | felixbuenemann/xlsxtream | https://github.com/felixbuenemann/xlsxtream | test/xlsxtream/worksheet_test.rb | Ruby | mit | 219 | master | 4,435 | # frozen_string_literal: true
require 'test_helper'
require 'stringio'
require 'xlsxtream/worksheet'
module Xlsxtream
class WorksheetTest < Minitest::Test
def test_empty_worksheet
io = StringIO.new
ws = Worksheet.new(io)
ws.close
expected = \
'<?xml version="1.0" encoding="UTF-8" ... |
github | felixbuenemann/xlsxtream | https://github.com/felixbuenemann/xlsxtream | test/xlsxtream/zip_kit_writer_test.rb | Ruby | mit | 219 | master | 2,737 | # frozen_string_literal: true
require 'test_helper'
require 'zip'
module Xlsxtream
class ZipKitWriterTest < Minitest::Test
def test_writes_of_multiple_files
zip_buf = Tempfile.new('ztio-test')
io = Xlsxtream::ZipKitWriter.with_output_to(zip_buf)
io.add_file("book1.xml")
io << '<?xml vers... |
github | felixbuenemann/xlsxtream | https://github.com/felixbuenemann/xlsxtream | test/xlsxtream/columns_test.rb | Ruby | mit | 219 | master | 1,462 | # frozen_string_literal: true
require 'test_helper'
require 'xlsxtream/row'
module Xlsxtream
class ColumnsTest < Minitest::Test
def test_no_width_column
column = Columns.new( [ {} ] )
expected = '<cols><col min="1" max="1"/></cols>'
actual = column.to_xml
assert_equal expected, actual
... |
github | felixbuenemann/xlsxtream | https://github.com/felixbuenemann/xlsxtream | test/xlsxtream/shared_string_table_test.rb | Ruby | mit | 219 | master | 711 | # frozen_string_literal: true
require 'test_helper'
require 'xlsxtream/shared_string_table'
module Xlsxtream
class SharedStringTableTest < Minitest::Test
def test_references
sst = SharedStringTable.new
assert_equal 0, sst.references
sst['hello']
sst['hello']
sst['world']
asser... |
github | felixbuenemann/xlsxtream | https://github.com/felixbuenemann/xlsxtream | test/xlsxtream/row_test.rb | Ruby | mit | 219 | master | 10,649 | # frozen_string_literal: true
require 'test_helper'
require 'xlsxtream/row'
module Xlsxtream
class RowTest < Minitest::Test
# =========================================================================
# Normal rows
# =========================================================================
def test_... |
github | felixbuenemann/xlsxtream | https://github.com/felixbuenemann/xlsxtream | test/xlsxtream/xml_test.rb | Ruby | mit | 219 | master | 1,916 | # frozen_string_literal: true
require 'test_helper'
require 'xlsxtream/xml'
module Xlsxtream
class XMLTest < Minitest::Test
def test_header
expected = %'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n'
assert_equal expected, XML.header
end
def test_strip
xml = <<-XML
... |
github | felixbuenemann/xlsxtream | https://github.com/felixbuenemann/xlsxtream | test/xlsxtream/workbook_test.rb | Ruby | mit | 219 | master | 21,336 | # frozen_string_literal: true
require 'test_helper'
require 'stringio'
require 'tempfile'
require 'xlsxtream/workbook'
module Xlsxtream
class WorksheetTest < Minitest::Test
class SpyWriter < Xlsxtream::ZipKitWriter
def initialize
@paths_to_file_contents = {}
@current = nil
end
... |
github | felixbuenemann/xlsxtream | https://github.com/felixbuenemann/xlsxtream | lib/xlsxtream/worksheet.rb | Ruby | mit | 219 | master | 1,230 | # frozen_string_literal: true
require "xlsxtream/xml"
require "xlsxtream/row"
module Xlsxtream
class Worksheet
def initialize(io, options = {})
@io = io
@rownum = 1
@closed = false
@options = options
@has_header_row = options.delete(:has_header_row)
write_header
end
... |
github | felixbuenemann/xlsxtream | https://github.com/felixbuenemann/xlsxtream | lib/xlsxtream/row.rb | Ruby | mit | 219 | master | 3,593 | # frozen_string_literal: true
require "date"
require "xlsxtream/xml"
module Xlsxtream
class Row
ENCODING = Encoding.find('UTF-8')
NUMBER_PATTERN = /\A-?[0-9]+(\.[0-9]+)?\z/.freeze
# ISO 8601 yyyy-mm-dd
DATE_PATTERN = /\A[0-9]{4}-[0-9]{2}-[0-9]{2}\z/.freeze
# ISO 8601 yyyy-mm-ddThh:mm:ss(.s)(Z|+... |
github | felixbuenemann/xlsxtream | https://github.com/felixbuenemann/xlsxtream | lib/xlsxtream/zip_kit_writer.rb | Ruby | mit | 219 | master | 2,442 | # frozen_string_literal: true
require "zip_kit"
module Xlsxtream
class ZipKitWriter
BUFFER_SIZE = 64 * 1024
def self.with_output_to(output)
if output.is_a?(self)
output
elsif output.is_a?(ZipKit::Streamer)
# If this is a Streamer which has already been initialized, it is likely t... |
github | felixbuenemann/xlsxtream | https://github.com/felixbuenemann/xlsxtream | lib/xlsxtream/workbook.rb | Ruby | mit | 219 | master | 9,104 | # frozen_string_literal: true
require "xlsxtream/errors"
require "xlsxtream/xml"
require "xlsxtream/shared_string_table"
require "xlsxtream/worksheet"
require "xlsxtream/zip_kit_writer"
module Xlsxtream
class Workbook
FONT_FAMILY_IDS = {
'' => 0,
'roman' => 1,
'swiss' => 2,... |
github | felixbuenemann/xlsxtream | https://github.com/felixbuenemann/xlsxtream | lib/xlsxtream/xml.rb | Ruby | mit | 219 | master | 1,331 | # frozen_string_literal: true
module Xlsxtream
module XML
XML_ESCAPES = {
'&' => '&',
'"' => '"',
'<' => '<',
'>' => '>',
}.freeze
# Escape first underscore of ST_Xstring sequences in input strings to appear as plaintext in Excel
HEX_ESCAPE_REGEXP = /_(x[0-9A-Fa... |
github | felixbuenemann/xlsxtream | https://github.com/felixbuenemann/xlsxtream | lib/xlsxtream/shared_string_table.rb | Ruby | mit | 219 | master | 304 | # frozen_string_literal: true
module Xlsxtream
class SharedStringTable < Hash
def initialize
@references = 0
super { |hash, string| hash[string] = hash.size }
end
def [](string)
@references += 1
super
end
def references
@references
end
end
end |
github | felixbuenemann/xlsxtream | https://github.com/felixbuenemann/xlsxtream | lib/xlsxtream/columns.rb | Ruby | mit | 219 | master | 2,131 | # frozen_string_literal: true
module Xlsxtream
class Columns
# Pass an Array of column options Hashes. Symbol Hash keys and associated
# values are as follows:
#
# +width_chars+:: Approximate column with in characters, calculated per
# MSDN docs as if using a default 11 point Ca... |
github | websterclay/knife-github-cookbooks | https://github.com/websterclay/knife-github-cookbooks | knife-github-cookbooks.gemspec | Ruby | apache-2.0 | 219 | master | 987 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "knife-github-cookbooks/version"
Gem::Specification.new do |s|
s.name = "knife-github-cookbooks"
s.version = Knife::GithubCookbooks::VERSION
s.platform = Gem::Platform::RUBY
s.has_rdoc = fals... |
github | websterclay/knife-github-cookbooks | https://github.com/websterclay/knife-github-cookbooks | lib/chef/knife/cookbook_github_compare.rb | Ruby | apache-2.0 | 219 | master | 3,172 | #
# Author:: Adam Jacob (<adam@opscode.com>)
# Author:: Jesse Newland (<jesse@websterclay.com>)
# Copyright:: Copyright (c) 2010 Opscode, Inc.
# Copyright:: Copyright (c) 2011 Webster Clay, LLC.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use... |
github | websterclay/knife-github-cookbooks | https://github.com/websterclay/knife-github-cookbooks | lib/chef/knife/cookbook_github_install.rb | Ruby | apache-2.0 | 219 | master | 5,048 | #
# Author:: Adam Jacob (<adam@opscode.com>)
# Author:: Jesse Newland (<jesse@websterclay.com>)
# Copyright:: Copyright (c) 2010 Opscode, Inc.
# Copyright:: Copyright (c) 2011 Webster Clay, LLC.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use... |
github | websterclay/knife-github-cookbooks | https://github.com/websterclay/knife-github-cookbooks | lib/chef/knife/core/coobook_scm_repo_extensions.rb | Ruby | apache-2.0 | 219 | master | 839 | class Chef
class Knife
class CookbookSCMRepoExtensions < CookbookSCMRepo
def finalize_updates_from_github(cookbook_name, github_path, sha)
if update_count = updated?(cookbook_name)
ui.info "#{update_count} files updated, committing changes"
git("add #{cookbook_name}")
... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | ruby_gnuplot.gemspec | Ruby | bsd-3-clause | 219 | master | 951 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'ruby_gnuplot/version'
Gem::Specification.new do |s|
s.name = 'gnuplot'
s.description = s.summary = "Utility library to aid in interacting with gnuplot from ruby"
s.version = RubyGnuplot::VE... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | Rakefile | Ruby | bsd-3-clause | 219 | master | 510 | require "bundler/gem_tasks"
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require 'rubygems/package_task'
require_relative 'lib/ruby_gnuplot/version'
desc 'run unit tests'
task :default => :test
Rake::TestTask.new do |t|
t.libs << "lib" << 'spec/support'
t.test_files = FileList['test/**/*.rb']
t.... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | spec/spec_helper.rb | Ruby | bsd-3-clause | 219 | master | 5,272 | # This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require it in any
# file... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | spec/integration/multtest_spec.rb | Ruby | bsd-3-clause | 219 | master | 1,178 | describe "Multtest Plot Example" do
let(:file_path) { 'spec/tmp/multtest_plot.eps' }
let(:fixture_path) { 'spec/fixtures/plots/multtest_plot.eps' }
let(:file_content) do
File.read(file_path).gsub(/CreationDate.*/, "")
end
let(:fixture_content) do
File.read(fixture_path).gsub(/CreationDate.*/, "")... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | spec/integration/histtest_spec.rb | Ruby | bsd-3-clause | 219 | master | 1,112 | describe "Histogram Plot Example" do
let(:file_path) { 'spec/tmp/histogram_plot.eps' }
let(:fixture_path) { 'spec/fixtures/plots/histogram_plot.eps' }
let(:file_content) do
File.read(file_path).gsub(/CreationDate.*/, "")
end
let(:fixture_content) do
File.read(fixture_path).gsub(/CreationDate.*/, ... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | spec/integration/arrtest_spec.rb | Ruby | bsd-3-clause | 219 | master | 929 | describe "Array Plot Example" do
let(:file_path) { 'spec/tmp/array_plot.eps' }
let(:fixture_path) { 'spec/fixtures/plots/array_plot.eps' }
let(:file_content) do
File.read(file_path).gsub(/CreationDate.*/, "")
end
let(:fixture_content) do
File.read(fixture_path).gsub(/CreationDate.*/, "")
end
... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | spec/integration/sinwave_spec.rb | Ruby | bsd-3-clause | 219 | master | 901 | describe "Sin Wave Plot Example" do
let(:file_path) { 'spec/tmp/sin_wave_plot.eps' }
let(:fixture_path) { 'spec/fixtures/plots/sin_wave_plot.eps' }
let(:file_content) do
File.read(file_path).gsub(/CreationDate.*/, "")
end
let(:fixture_content) do
File.read(fixture_path).gsub(/CreationDate.*/, "")... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | spec/lib/ruby_gnuplot/plot_spec.rb | Ruby | bsd-3-clause | 219 | master | 5,464 | shared_examples 'quotes value when setting in a plot for' do |field|
describe "##{field}" do
before do
plot.public_send(field, 'text')
end
let(:expected_settings) do
[
[:set, field.to_s, '"text"'],
[:set, field.to_s, '"new text"']
]
end
it 'quotes value when set... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | spec/lib/ruby_gnuplot/data_set_spec.rb | Ruby | bsd-3-clause | 219 | master | 1,954 | require 'spec_helper'
describe Gnuplot::DataSet do
subject(:data_set) { described_class.new(data) }
let(:data) { nil }
describe '#to_gplot' do
context 'when data is an empty array' do
let(:data) { [] }
it do
expect(data_set.to_gplot).to eq('')
end
end
context 'when data ... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | spec/lib/ruby_gnuplot/plot/style_spec.rb | Ruby | bsd-3-clause | 219 | master | 1,540 | describe Gnuplot::Plot::Style do
subject(:style) { described_class.new }
let(:index) { style.index }
describe '#to_s' do
context "when nothing has been set" do
it 'creates an empty style' do
expect(style.to_s).to eq("set style line #{index}")
end
end
context 'when setting the st... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | spec/support/models/random_generator.rb | Ruby | bsd-3-clause | 219 | master | 278 | # frozen_string_literal: true
class RandomGenerator
KAPA = 3.95578
class << self
def rand
@rand ||= Random.rand
@rand = KAPA * @rand * (1 - @rand)
end
def seed(value)
@rand = value.abs % 1
@rand = nil if @rand.zero?
end
end
end |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | test/arrtest.rb | Ruby | bsd-3-clause | 219 | master | 354 | require 'gnuplot'
Gnuplot.open do |gp|
Gnuplot::Plot.new( gp ) do |plot|
plot.title "Array Plot Example"
plot.ylabel "x"
plot.xlabel "x^2"
x = (0..50).collect { |v| v.to_f }
y = x.collect { |v| v ** 2 }
plot.data << Gnuplot::DataSet.new( [x, y] ) do |ds|
ds.with = "linespoints"
... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | test/histtest.rb | Ruby | bsd-3-clause | 219 | master | 433 | require 'gnuplot'
Gnuplot.open do |gp|
gp << "bin(x, s) = s*int(x/s)\n"
Gnuplot::Plot.new( gp ) do |plot|
plot.title "Histogram"
plot.xlabel "x"
plot.ylabel "frequency"
x = (0..500).collect { |v| (rand()-0.5)**3 }
plot.data << Gnuplot::DataSet.new( [x] ) do |ds|
ds.title = "smooth freq... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | test/multtest.rb | Ruby | bsd-3-clause | 219 | master | 596 | require 'gnuplot'
# File.open( "gnuplot.dat", "w") do |gp|
Gnuplot.open do |gp|
Gnuplot::Plot.new( gp ) do |plot|
plot.xrange "[-10:10]"
plot.title "Sin Wave Example"
plot.ylabel "x"
plot.xlabel "sin(x)"
x = (0..50).collect { |v| v.to_f }
y = x.collect { |v| v ** 2 }
plot.data = [
... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | test/test_gnuplot.rb | Ruby | bsd-3-clause | 219 | master | 3,884 | # -*- ruby -*-
require 'gnuplot'
require 'minitest/autorun'
class StdDataTest < MiniTest::Test
def test_array_1d
data = (0..5).to_a
ds = Gnuplot::DataSet.new( data )
assert data == ds.data
assert data.join("\n") + "\n", ds.to_gplot
end
def test_empty_array
data = []
ds = Gnuplot::Data... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | test/sinwave.rb | Ruby | bsd-3-clause | 219 | master | 311 | require 'gnuplot'
Gnuplot.open do |gp|
Gnuplot::Plot.new( gp ) do |plot|
plot.xrange "[-10:10]"
plot.title "Sin Wave Example"
plot.ylabel "x"
plot.xlabel "sin(x)"
plot.data << Gnuplot::DataSet.new( "sin(x)" ) do |ds|
ds.with = "lines"
ds.linewidth = 4
end
end
end |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | lib/gnuplot.rb | Ruby | bsd-3-clause | 219 | master | 10,096 | # Methods and variables for interacting with the gnuplot process. Most of
# these methods are for sending data to a gnuplot process, not for reading from
# it. Most of the methods are implemented as added methods to the built in
# classes.
require 'matrix'
module Gnuplot
# Trivial implementation of the which com... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | examples/discrete_points.rb | Ruby | bsd-3-clause | 219 | master | 416 | $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
require "gnuplot"
Gnuplot.open do |gp|
Gnuplot::Plot.new( gp ) do |plot|
plot.title "Array Plot Example"
plot.ylabel "x^2"
plot.xlabel "x"
x = (0..50).collect { |v| v.to_f }
y = x.collect { |v| v ** 2 }
plot.data << Gnuplot:... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | examples/3d_surface_plot.rb | Ruby | bsd-3-clause | 219 | master | 279 | $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
require "gnuplot"
Gnuplot.open do |gp|
Gnuplot::SPlot.new( gp ) do |plot|
plot.grid
plot.data = [
Gnuplot::DataSet.new( "x**2+y**2" ) do |ds|
ds.with = "pm3d"
end
]
end
sleep 10
end |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | examples/output_image_file.rb | Ruby | bsd-3-clause | 219 | master | 935 | $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
require "gnuplot"
# See sin_wave.rb first
Gnuplot.open do |gp|
Gnuplot::Plot.new( gp ) do |plot|
# The following lines allow outputting the graph to an image file.
# The first set the kind of image that you want, while the second
# redirects... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | examples/histogram.rb | Ruby | bsd-3-clause | 219 | master | 978 | $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
require "gnuplot"
Gnuplot.open do |gp|
Gnuplot::Plot.new(gp) do |plot|
plot.title "Histogram example"
plot.style "data histograms"
plot.xtics "nomirror rotate by -45"
titles = %w{decade Austria Hungary Belgium}
data = [
... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | examples/multiple_data_sets.rb | Ruby | bsd-3-clause | 219 | master | 621 | $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
require "gnuplot"
Gnuplot.open do |gp|
Gnuplot::Plot.new( gp ) do |plot|
plot.xrange "[-10:10]"
plot.title "Sin Wave Example"
plot.ylabel "sin(x)"
plot.xlabel "x"
x = (0..50).collect { |v| v.to_f }
y = x.collect { |v| v ** 2 ... |
github | rdp/ruby_gnuplot | https://github.com/rdp/ruby_gnuplot | examples/sin_wave.rb | Ruby | bsd-3-clause | 219 | master | 388 | $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
require "gnuplot"
Gnuplot.open do |gp|
Gnuplot::Plot.new( gp ) do |plot|
plot.xrange "[-10:10]"
plot.title "Sin Wave Example"
plot.ylabel "sin(x)"
plot.xlabel "x"
plot.data << Gnuplot::DataSet.new( "sin(x)" ) do |ds|
ds.wit... |
github | papertrail/remote_syslog | https://github.com/papertrail/remote_syslog | remote_syslog.gemspec | Ruby | mit | 219 | master | 3,917 | # https://github.com/mojombo/rakegem
Gem::Specification.new do |s|
s.specification_version = 2 if s.respond_to? :specification_version=
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.rubygems_version = '1.3.5'
## Leave these as is they will be modified... |
github | papertrail/remote_syslog | https://github.com/papertrail/remote_syslog | Rakefile | Ruby | mit | 219 | master | 3,779 | require 'rubygems'
require 'rake'
require 'date'
#############################################################################
#
# Helper functions
#
#############################################################################
def name
@name ||= Dir['*.gemspec'].first.split('.').first
end
def version
line = Fil... |
github | papertrail/remote_syslog | https://github.com/papertrail/remote_syslog | test/unit/message_generator_test.rb | Ruby | mit | 219 | master | 399 | require 'test/unit'
require 'remote_syslog/message_generator'
class MessageGeneratorTest < Test::Unit::TestCase
def test_prepend_prepend
socket = []
def socket.write(packet)
self << packet
end
generator = RemoteSyslog::MessageGenerator.new(socket, {:prepend => 'crazy_prefix '})
generator.tr... |
github | papertrail/remote_syslog | https://github.com/papertrail/remote_syslog | lib/remote_syslog/tcp_endpoint.rb | Ruby | mit | 219 | master | 1,992 | require 'eventmachine'
module RemoteSyslog
# Additional class that uses TCP but no TLS. Has the benefit of a greater max packet size
class TcpEndpoint
class Handler < EventMachine::Connection
def initialize(endpoint)
@endpoint = endpoint
super()
end
def connection_completed
... |
github | papertrail/remote_syslog | https://github.com/papertrail/remote_syslog | lib/remote_syslog/message_generator.rb | Ruby | mit | 219 | master | 1,682 | require 'socket'
require 'syslog_protocol'
module RemoteSyslog
class MessageGenerator
COLORED_REGEXP = /\e\[(?:(?:[0-9]{1,3});){0,2}(?:[0-9]{1,3})m/
def initialize(socket, options = {})
@socket = socket
@parse_fields = options[:parse_fields]
@strip_color = options[:strip_color]
... |
github | papertrail/remote_syslog | https://github.com/papertrail/remote_syslog | lib/remote_syslog/cli.rb | Ruby | mit | 219 | master | 9,017 | require 'optparse'
require 'yaml'
require 'pathname'
require 'servolux'
require 'remote_syslog/agent'
module RemoteSyslog
class Cli
FIELD_REGEXES = {
'syslog' => /^(\w+ +\d+ \S+) (\S+) ([^: ]+):? (.*)$/,
'rfc3339' => /^(\S+) (\S+) ([^: ]+):? (.*)$/
}
DEFAULT_PID_FILES = [
"/var/run/re... |
github | papertrail/remote_syslog | https://github.com/papertrail/remote_syslog | lib/remote_syslog/eventmachine_reader.rb | Ruby | mit | 219 | master | 1,190 | require 'eventmachine'
require 'eventmachine-tail'
require 'em-dns-resolver'
# Force eventmachine-tail not to change the encoding
# This will allow ruby 1.9 to deal with any file data
old_verbose, $VERBOSE = $VERBOSE, nil
EventMachine::FileTail::FORCE_ENCODING = false
$VERBOSE = old_verbose
module RemoteSyslog
clas... |
github | papertrail/remote_syslog | https://github.com/papertrail/remote_syslog | lib/remote_syslog/glob_watch.rb | Ruby | mit | 219 | master | 508 | require 'eventmachine-tail'
module RemoteSyslog
class GlobWatch < EventMachine::FileGlobWatch
def initialize(path, interval, exclude_files, callback)
@exclude_files = exclude_files
@callback = callback
super(path, interval)
end
def file_found(path)
# Check if we should exclude t... |
github | papertrail/remote_syslog | https://github.com/papertrail/remote_syslog | lib/remote_syslog/file_tail_reader.rb | Ruby | mit | 219 | master | 950 | require 'file/tail'
module RemoteSyslog
class FileTailReader
def initialize(path, options = {}, &block)
@path = path
@callback = options[:callback] || block
@logger = options[:logger] || Logger.new(STDERR)
@tag = options[:program] || File.basename(path)
# Remove characters t... |
github | papertrail/remote_syslog | https://github.com/papertrail/remote_syslog | lib/remote_syslog/tls_endpoint.rb | Ruby | mit | 219 | master | 2,610 | require 'eventmachine'
module RemoteSyslog
class TlsEndpoint
class Handler < EventMachine::Connection
def initialize(endpoint)
@endpoint = endpoint
super()
end
def connection_completed
start_tls(:verify_peer => @endpoint.server_cert != nil,
:cert_chain_file =>... |
github | papertrail/remote_syslog | https://github.com/papertrail/remote_syslog | lib/remote_syslog/agent.rb | Ruby | mit | 219 | master | 3,908 | require 'eventmachine'
require 'servolux'
require 'remote_syslog/eventmachine_reader'
require 'remote_syslog/file_tail_reader'
require 'remote_syslog/glob_watch'
require 'remote_syslog/message_generator'
require 'remote_syslog/udp_endpoint'
require 'remote_syslog/tls_endpoint'
require 'remote_syslog/tcp_endpoint'
mod... |
github | papertrail/remote_syslog | https://github.com/papertrail/remote_syslog | lib/remote_syslog/udp_endpoint.rb | Ruby | mit | 219 | master | 833 | require 'eventmachine'
module RemoteSyslog
class UdpEndpoint
attr_reader :logger
def initialize(address, port, options = {})
@address = address
@port = port.to_i
@socket = EventMachine.open_datagram_socket('0.0.0.0', 0)
@logger = options[:logger] || Logger.new(STDERR)
# T... |
github | sqids/sqids-ruby | https://github.com/sqids/sqids-ruby | sqids.gemspec | Ruby | mit | 219 | main | 628 | # frozen_string_literal: true
require 'English'
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'sqids'
Gem::Specification.new do |gem|
gem.name = 'sqids'
gem.version = '0.2.2'
gem.authors = ['Sqids Maintainers']
gem.summary = '... |
github | sqids/sqids-ruby | https://github.com/sqids/sqids-ruby | lib/sqids.rb | Ruby | mit | 219 | main | 9,863 | # frozen_string_literal: true
require 'set'
class Sqids
DEFAULT_ALPHABET = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
DEFAULT_MIN_LENGTH = 0
# rubocop:disable Metrics/CollectionLiteralLength, Layout/LineLength
DEFAULT_BLOCKLIST = %w[0rgasm 1d10t 1d1ot 1di0t 1diot 1eccacu10 1eccacu1o 1ecc... |
github | sqids/sqids-ruby | https://github.com/sqids/sqids-ruby | spec/alphabet_spec.rb | Ruby | mit | 219 | main | 1,298 | # frozen_string_literal: true
require 'rspec'
require_relative '../lib/sqids'
describe Sqids do
it 'encodes and decodes using simple alphabet' do
sqids = Sqids.new(alphabet: '0123456789abcdef')
numbers = [1, 2, 3]
id = '489158'
expect(sqids.encode(numbers)).to eq(id)
expect(sqids.decode(id)).t... |
github | sqids/sqids-ruby | https://github.com/sqids/sqids-ruby | spec/encoding_spec.rb | Ruby | mit | 219 | main | 2,711 | # frozen_string_literal: true
require 'rspec'
require_relative '../lib/sqids'
describe 'Sqids' do
it 'simple' do
sqids = Sqids.new
numbers = [1, 2, 3]
id = '86Rf07'
expect(sqids.encode(numbers)).to eq(id)
expect(sqids.decode(id)).to eq(numbers)
end
it 'different inputs' do
sqids = Sqi... |
github | sqids/sqids-ruby | https://github.com/sqids/sqids-ruby | spec/blocklist_spec.rb | Ruby | mit | 219 | main | 2,533 | # frozen_string_literal: true
require 'rspec'
require 'set'
require_relative '../lib/sqids'
describe Sqids do
it 'uses default blocklist if no custom blocklist is provided' do
sqids = Sqids.new
expect(sqids.decode('aho1e')).to eq([4_572_721])
expect(sqids.encode([4_572_721])).to eq('JExTR')
end
it... |
github | sqids/sqids-ruby | https://github.com/sqids/sqids-ruby | spec/minlength_spec.rb | Ruby | mit | 219 | main | 3,227 | # frozen_string_literal: true
require 'rspec'
require_relative '../lib/sqids'
describe Sqids do
let(:default_alphabet) { Sqids::DEFAULT_ALPHABET }
it 'encodes and decodes simple numbers' do
sqids = Sqids.new(min_length: default_alphabet.length)
numbers = [1, 2, 3]
id = '86Rf07xd4zBmiJXQG6otHEbew02c3... |
github | barsoom/traco | https://github.com/barsoom/traco | Gemfile | Ruby | mit | 219 | master | 297 | source "https://rubygems.org"
# Specify your gem's dependencies in the .gemspec.
gemspec
group :benchmark do
gem "benchmark-ips"
end
group :development do
gem "barsoom_utils"
gem "rubocop"
end
group :development, :test do
gem "appraisal"
gem "rake"
gem "rspec"
gem "sqlite3"
end |
github | barsoom/traco | https://github.com/barsoom/traco | traco.gemspec | Ruby | mit | 219 | master | 648 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("lib", __dir__)
require "traco/version"
Gem::Specification.new do |s|
s.name = "traco"
s.version = Traco::VERSION
s.authors = [ "Henrik Nyh" ]
s.email = [ "henrik@barsoom.se" ]
s.homepage = ""
s.summary = "Translatable columns f... |
github | barsoom/traco | https://github.com/barsoom/traco | spec/spec_helper.rb | Ruby | mit | 219 | master | 260 | require "i18n"
RSpec.configure do |config|
config.filter_run focus: true
config.run_all_when_everything_filtered = true
config.disable_monkey_patching!
end
I18n.enforce_available_locales = false
I18n::Backend::Simple.include(I18n::Backend::Fallbacks) |
github | barsoom/traco | https://github.com/barsoom/traco | spec/traco_spec.rb | Ruby | mit | 219 | master | 11,190 | # encoding: utf-8
require "spec_helper_models"
require "traco"
RSpec.describe Traco, ".split_localized_column" do
subject { described_class }
it "returns attribute and locale" do
expect(subject.split_localized_column("title_sv")).to eq [ :title, :sv ]
end
it "handles normalized locales" do
expect(su... |
github | barsoom/traco | https://github.com/barsoom/traco | spec/locale_fallbacks_spec.rb | Ruby | mit | 219 | master | 2,285 | require "traco/locale_fallbacks"
RSpec.describe Traco::LocaleFallbacks do
describe ".new" do
it "raises ArgumentError if an unknown argument passed in" do
expect { Traco::LocaleFallbacks.new(:foo) }.to raise_error(ArgumentError)
expect { Traco::LocaleFallbacks.new(nil) }.to raise_error(ArgumentError)... |
github | barsoom/traco | https://github.com/barsoom/traco | spec/spec_helper_models.rb | Ruby | mit | 219 | master | 824 | RSpec.configure do |config|
config.before do
# Clear class state before each spec.
Object.send(:remove_const, "Post")
Object.send(:remove_const, "SubPost")
load "app/post.rb"
# Known state.
I18n.default_locale = :sv
end
end
# Test against real ActiveRecord models.
# Very much based on the ... |
github | barsoom/traco | https://github.com/barsoom/traco | benchmarks/overhead.rb | Ruby | mit | 219 | master | 963 | # This benchmark tests how fast a Traco-wrapped attribute is
# compared to the plain Active Record attribute.
require "bundler/setup"
require "benchmark/ips"
require "active_record"
require "traco"
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
I18n.enforce_available_locales = false... |
github | barsoom/traco | https://github.com/barsoom/traco | lib/traco.rb | Ruby | mit | 219 | master | 1,633 | require "traco/version"
require "traco/attributes"
require "traco/class_methods"
require "traco/locale_fallbacks"
require "traco/translates"
module Traco
COLUMN_RE =
/\A
(?<attribute>\w+?) # title
_ # _
(?<primary>[a-z]{2}) # pt
(
_ ... |
github | barsoom/traco | https://github.com/barsoom/traco | lib/traco/class_methods.rb | Ruby | mit | 219 | master | 2,570 | module Traco
module ClassMethods
def locales_for_attribute(attribute)
traco_cache(attribute, fallback: LocaleFallbacks::ANY_FALLBACK).keys
end
def locale_columns(*attributes)
attributes = attributes.presence || translatable_attributes
attributes.flat_map { |attribute|
_locale_c... |
github | barsoom/traco | https://github.com/barsoom/traco | lib/traco/attributes.rb | Ruby | mit | 219 | master | 2,261 | module Traco
class Attributes < Module
def initialize(*attributes)
@options = attributes.extract_options!
@attributes = attributes.map(&:to_sym)
attributes.each do |attribute|
define_reader(attribute)
define_writer(attribute)
define_query(attribute)
end
end
... |
github | barsoom/traco | https://github.com/barsoom/traco | lib/traco/locale_fallbacks.rb | Ruby | mit | 219 | master | 1,590 | # Intended to be API compatible with https://github.com/svenfuchs/i18n/blob/master/lib/i18n/locale/fallbacks.rb
module Traco
class LocaleFallbacks
OPTIONS = [
DEFAULT_FALLBACK = :default,
ANY_FALLBACK = :any,
NO_FALLBACK = false,
DEFAULT_FIRST_FALLBACK = :default_first,
I18N_FALLBAC... |
github | zverok/time_calc | https://github.com/zverok/time_calc | time_calc.gemspec | Ruby | mit | 219 | master | 1,757 | require './lib/time_calc/version'
Gem::Specification.new do |s|
s.name = 'time_calc'
s.version = TimeCalc::VERSION
s.authors = ['Victor Shepelev']
s.email = 'zverok.offline@gmail.com'
s.homepage = 'https://github.com/zverok/time_calc'
s.metadata = {
'bug_tracker_uri' => 'https://github.com/zve... |
github | zverok/time_calc | https://github.com/zverok/time_calc | lib/time_calc.rb | Ruby | mit | 219 | master | 10,809 | # frozen_string_literal: true
require 'date'
require 'time'
require_relative 'time_calc/units'
require_relative 'time_calc/types'
require_relative 'time_calc/dst'
require_relative 'time_calc/value'
# Module for time arithmetic.
#
# Examples of usage:
#
# ```ruby
# TimeCalc.(Time.now).+(1, :day)
# # => 2019-07-04 23:... |
github | zverok/time_calc | https://github.com/zverok/time_calc | lib/time_calc/dst.rb | Ruby | mit | 219 | master | 1,409 | # frozen_string_literal: true
class TimeCalc
# @private
module DST
extend self
def fix_value(val, origin)
case (c = compare(origin.unwrap, val.unwrap))
when nil, 0
val
else
val.+(c, :hour)
end
end
def fix_day_diff(from, to, diff)
# Just add one day wh... |
github | zverok/time_calc | https://github.com/zverok/time_calc | lib/time_calc/value.rb | Ruby | mit | 219 | master | 7,569 | # frozen_string_literal: true
require 'backports/2.6.0/enumerable/to_h'
require 'backports/2.6.0/array/to_h'
require 'backports/2.6.0/hash/to_h'
require 'backports/2.6.0/kernel/then'
require 'backports/2.5.0/hash/slice'
require 'backports/2.5.0/enumerable/all'
require 'backports/2.7.0/enumerator/produce'
class TimeCa... |
github | zverok/time_calc | https://github.com/zverok/time_calc | lib/time_calc/units.rb | Ruby | mit | 219 | master | 1,218 | # frozen_string_literal: true
class TimeCalc
# @private
# Unit-related constants and utilities for fetching their values
module Units
ALL = %i[year month week day hour min sec].freeze
NATURAL = %i[year month day hour min sec].freeze
STRUCTURAL = %i[year month day hour min sec subsec].freeze
SYNO... |
github | zverok/time_calc | https://github.com/zverok/time_calc | lib/time_calc/op.rb | Ruby | mit | 219 | master | 2,217 | # frozen_string_literal: true
class TimeCalc
# Abstraction over chain of time math operations that can be applied to a time or date.
#
# @example
# op = TimeCalc.+(1, :day).floor(:hour)
# # => <TimeCalc::Op +(1 day).floor(hour)>
# op.call(Time.now)
# # => 2019-07-04 22:00:00 +0300
# arra... |
github | zverok/time_calc | https://github.com/zverok/time_calc | lib/time_calc/types.rb | Ruby | mit | 219 | master | 3,157 | # frozen_string_literal: true
class TimeCalc
# @private
# Tries to encapsulate all the differences between Time, Date, DateTime
module Types
extend self
ATTRS = {
'Time' => %i[year month day hour min sec subsec utc_offset],
'Date' => %i[year month day],
'DateTime' => %i[year month day ... |
github | zverok/time_calc | https://github.com/zverok/time_calc | lib/time_calc/diff.rb | Ruby | mit | 219 | master | 8,472 | # frozen_string_literal: true
class TimeCalc
# Represents difference between two time-or-date values.
#
# Typically created with just
#
# ```ruby
# TimeCalc.(t1) - t2
# ```
#
# Allows to easily and correctly calculate number of years/monthes/days/etc between two points in
# time.
#
# @example
... |
github | zverok/time_calc | https://github.com/zverok/time_calc | lib/time_calc/sequence.rb | Ruby | mit | 219 | master | 4,088 | # frozen_string_literal: true
class TimeCalc
# `Sequence` is a Enumerable, allowing to iterate from start point in time over defined step, till
# end point or endlessly.
#
# @example
# seq = TimeCalc.(Time.parse('2019-06-01 14:50')).step(1, :day).for(2, :weeks)
# # => #<TimeCalc::Sequence (2019-06-01 1... |
github | zverok/time_calc | https://github.com/zverok/time_calc | spec/spec_helper.rb | Ruby | mit | 219 | master | 1,167 | # frozen_string_literal: true
require 'time'
require 'date'
require 'yaml'
require 'csv'
require 'pp'
require 'rspec/its'
require 'saharspec'
require 'simplecov'
require 'active_support/time_with_zone'
require 'active_support/core_ext/time' # otherwise TimeWithZone can't #to_s itself :facepalm:
if RUBY_VERSION >= '... |
github | zverok/time_calc | https://github.com/zverok/time_calc | spec/time_calc_spec.rb | Ruby | mit | 219 | master | 1,881 | # frozen_string_literal: true
RSpec.describe TimeCalc do
describe 'instance' do
subject(:calc) { described_class.new(start) }
let(:start) { t('2018-03-01 18:30:45 +02') }
its(:inspect) { is_expected.to eq '#<TimeCalc(2018-03-01 18:30:45 +0200)>' }
it 'delegates operations that return time' do
... |
github | zverok/time_calc | https://github.com/zverok/time_calc | spec/time_calc/value_spec.rb | Ruby | mit | 219 | master | 9,739 | # frozen_string_literal: true
require 'time_calc/value'
RSpec.describe TimeCalc::Value do
subject(:value) { described_class.new(source) }
describe '.wrap' do
subject { described_class.method(:wrap) }
its_call(t('2019-06-28 14:28:48.123 +03')) {
is_expected.to ret be_a(described_class).and have_att... |
github | zverok/time_calc | https://github.com/zverok/time_calc | spec/time_calc/diff_spec.rb | Ruby | mit | 219 | master | 5,062 | # frozen_string_literal: true
RSpec.describe TimeCalc::Diff do
subject(:diff) { described_class.new(t('2020-06-12 12:28 +03'), t('2019-06-01 14:50 +03')) }
its(:inspect) { is_expected.to eq '#<TimeCalc::Diff(2020-06-12 12:28:00 +0300 − 2019-06-01 14:50:00 +0300)>' }
describe '#divmod' do
subject { diff.met... |
github | zverok/time_calc | https://github.com/zverok/time_calc | spec/time_calc/value_math_spec.rb | Ruby | mit | 219 | master | 825 | # frozen_string_literal: true
require 'time_calc/value'
RSpec.describe TimeCalc::Value, 'math' do
{
plus: :+,
minus: :-,
floor: :floor,
ceil: :ceil
# round: :round
}.each do |filename, sym|
describe "##{sym}" do
CSV.read("spec/fixtures/#{filename}.csv")
.reject { |r| r.first... |
github | zverok/time_calc | https://github.com/zverok/time_calc | spec/time_calc/op_spec.rb | Ruby | mit | 219 | master | 791 | # frozen_string_literal: true
RSpec.describe TimeCalc::Op do
subject(:op) { described_class.new([[:+, [1, :day]], [:round, [:hour]]]) }
its(:chain) { is_expected.to eq [[:+, [1, :day]], [:round, [:hour]]] }
its(:inspect) { is_expected.to eq '<TimeCalc::Op +(1 day).round(hour)>' }
describe '#<op>' do
subj... |
github | zverok/time_calc | https://github.com/zverok/time_calc | spec/time_calc/sequence_spec.rb | Ruby | mit | 219 | master | 2,932 | # frozen_string_literal: true
RSpec.describe TimeCalc::Sequence do
subject(:seq) { described_class.new(**args) }
let(:args) { {from: vt('2019-06-01 14:30 +03'), to: vt('2019-06-05 17:20 +03'), step: [1, :day]} }
its(:inspect) {
is_expected.to eq '#<TimeCalc::Sequence (2019-06-01 14:30:00 +0300 - 2019-06-05... |
github | customink/secondbase | https://github.com/customink/secondbase | Rakefile | Ruby | mit | 219 | master | 671 | require 'bundler/gem_tasks'
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs = ['lib','test']
t.test_files = FileList['test/**/*_test.rb']
t.verbose = true
end
desc "Bootstrap development/test DB setup."
task :bootstrap do
# ENV['DATBASE_URL'] = 'mysql://root@localhost/secondbase_url'
require_relati... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.