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 | sous-chefs/memcached | https://github.com/sous-chefs/memcached | spec/spec_helper.rb | Ruby | apache-2.0 | 48 | main | 569 | require 'chefspec'
require 'chefspec/berkshelf'
shared_context 'memcached_stubs' do
before do
stub_command('getent passwd memcached').and_return(false)
stub_command('getent passwd nobody').and_return(false)
stub_command('getent passwd memcache').and_return(false)
stub_command('dpkg -s memcached').and... |
github | sous-chefs/memcached | https://github.com/sous-chefs/memcached | spec/unit/recipes/default_spec.rb | Ruby | apache-2.0 | 48 | main | 5,618 | require 'spec_helper'
describe 'memcached::default' do
include_context 'memcached_stubs'
context 'on rhel 7' do
platform 'redhat', '7'
step_into :memcached_instance
it do
is_expected.to start_memcached_instance('memcached').with(
memory: 64,
port: 11211,
udp_port: 11211,... |
github | sous-chefs/memcached | https://github.com/sous-chefs/memcached | spec/unit/recipes/instance_spec.rb | Ruby | apache-2.0 | 48 | main | 6,493 | require 'spec_helper'
describe 'test::instance' do
include_context 'memcached_stubs'
context 'on rhel 7' do
platform 'redhat', '7'
step_into :memcached_instance, :memcached_instance_systemd
it do
is_expected.to start_memcached_instance('web_cache').with(
memory: 64,
port: 11212,... |
github | sous-chefs/memcached | https://github.com/sous-chefs/memcached | spec/unit/recipes/enable_default_instance_spec.rb | Ruby | apache-2.0 | 48 | main | 303 | require 'spec_helper'
describe 'test::enable_default_instance' do
platform 'ubuntu'
step_into :memcached_instance
include_context 'memcached_stubs'
it { is_expected.to_not stop_service('disable default memcached') }
it { is_expected.to_not disable_service('disable default memcached') }
end |
github | tokumine/GData | https://github.com/tokumine/GData | Rakefile | Ruby | apache-2.0 | 48 | master | 2,597 | # Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
github | tokumine/GData | https://github.com/tokumine/GData | gdata_19.gemspec | Ruby | apache-2.0 | 48 | master | 13,335 | # 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{gdata_19}
s.version = "1.1.5"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubyg... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata.rb | Ruby | apache-2.0 | 48 | master | 792 | # Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client.rb | Ruby | apache-2.0 | 48 | master | 2,323 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/auth.rb | Ruby | apache-2.0 | 48 | master | 745 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/http.rb | Ruby | apache-2.0 | 48 | master | 726 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/auth/authsub.rb | Ruby | apache-2.0 | 48 | master | 5,731 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/auth/clientlogin.rb | Ruby | apache-2.0 | 48 | master | 3,601 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/photos.rb | Ruby | apache-2.0 | 48 | master | 972 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/finance.rb | Ruby | apache-2.0 | 48 | master | 939 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/doclist.rb | Ruby | apache-2.0 | 48 | master | 941 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/analytics.rb | Ruby | apache-2.0 | 48 | master | 944 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/gbase.rb | Ruby | apache-2.0 | 48 | master | 933 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/booksearch.rb | Ruby | apache-2.0 | 48 | master | 944 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/base.rb | Ruby | apache-2.0 | 48 | master | 6,374 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/webmaster_tools.rb | Ruby | apache-2.0 | 48 | master | 961 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/spreadsheets.rb | Ruby | apache-2.0 | 48 | master | 944 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/gmail.rb | Ruby | apache-2.0 | 48 | master | 937 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/health.rb | Ruby | apache-2.0 | 48 | master | 932 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/blogger.rb | Ruby | apache-2.0 | 48 | master | 928 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/contacts.rb | Ruby | apache-2.0 | 48 | master | 929 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/apps.rb | Ruby | apache-2.0 | 48 | master | 864 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/notebook.rb | Ruby | apache-2.0 | 48 | master | 939 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/calendar.rb | Ruby | apache-2.0 | 48 | master | 1,895 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/client/youtube.rb | Ruby | apache-2.0 | 48 | master | 1,564 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/http/response.rb | Ruby | apache-2.0 | 48 | master | 1,286 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/http/mime_body.rb | Ruby | apache-2.0 | 48 | master | 3,138 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/http/default_service.rb | Ruby | apache-2.0 | 48 | master | 2,656 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | lib/gdata/http/request.rb | Ruby | apache-2.0 | 48 | master | 2,149 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | test/tc_gdata_http_mime_body.rb | Ruby | apache-2.0 | 48 | master | 1,573 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | test/ts_gdata_client.rb | Ruby | apache-2.0 | 48 | master | 987 | # Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
github | tokumine/GData | https://github.com/tokumine/GData | test/ts_gdata_http.rb | Ruby | apache-2.0 | 48 | master | 832 | # Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
github | tokumine/GData | https://github.com/tokumine/GData | test/tc_gdata_client_base.rb | Ruby | apache-2.0 | 48 | master | 1,266 | # Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
github | tokumine/GData | https://github.com/tokumine/GData | test/ts_gdata_auth.rb | Ruby | apache-2.0 | 48 | master | 837 | # Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
github | tokumine/GData | https://github.com/tokumine/GData | test/tc_gdata_auth_authsub.rb | Ruby | apache-2.0 | 48 | master | 1,754 | # Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
github | tokumine/GData | https://github.com/tokumine/GData | test/test_helper.rb | Ruby | apache-2.0 | 48 | master | 1,410 | # Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
github | tokumine/GData | https://github.com/tokumine/GData | test/tc_gdata_client_calendar.rb | Ruby | apache-2.0 | 48 | master | 1,400 | # Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
github | tokumine/GData | https://github.com/tokumine/GData | test/ts_gdata.rb | Ruby | apache-2.0 | 48 | master | 1,527 | # encoding: UTF-8
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | tokumine/GData | https://github.com/tokumine/GData | test/tc_gdata_auth_clientlogin.rb | Ruby | apache-2.0 | 48 | master | 1,808 | # Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
github | tokumine/GData | https://github.com/tokumine/GData | test/tc_gdata_client_youtube.rb | Ruby | apache-2.0 | 48 | master | 2,409 | # Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
github | tokumine/GData | https://github.com/tokumine/GData | test/tc_gdata_http_request.rb | Ruby | apache-2.0 | 48 | master | 1,217 | # Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
github | tokumine/GData | https://github.com/tokumine/GData | test/tc_gdata_client_photos.rb | Ruby | apache-2.0 | 48 | master | 2,202 | # Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
github | tokumine/GData | https://github.com/tokumine/GData | bin/test_captcha.rb | Ruby | apache-2.0 | 48 | master | 1,392 | #!/usr/bin/ruby
#
# Copyright (C) 2008 Google Inc.
#
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
github | piotrmurach/strings-truncation | https://github.com/piotrmurach/strings-truncation | Gemfile | Ruby | mit | 48 | master | 468 | source "https://rubygems.org"
gemspec
group :test do
gem "activesupport"
gem "benchmark-ips", "~> 2.7.2"
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.5.0")
gem "coveralls_reborn", "~> 0.22.0"
gem "simplecov", "~> 0.21.0"
end
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.1.0")
... |
github | piotrmurach/strings-truncation | https://github.com/piotrmurach/strings-truncation | strings-truncation.gemspec | Ruby | mit | 48 | master | 1,639 | # frozen_string_literal: true
require_relative "lib/strings/truncation/version"
Gem::Specification.new do |spec|
spec.name = "strings-truncation"
spec.version = Strings::Truncation::VERSION
spec.authors = ["Piotr Murach"]
spec.email = ["piotr@piotrmurach.com"]
spec.summary ... |
github | piotrmurach/strings-truncation | https://github.com/piotrmurach/strings-truncation | tasks/console.rake | Ruby | mit | 48 | master | 239 | # frozen_string_literal: true
desc "Load gem inside irb console"
task :console do
require "irb"
require "irb/completion"
require File.join(__FILE__, "../../lib/strings-truncation")
ARGV.clear
IRB.start
end
task c: %w[ console ] |
github | piotrmurach/strings-truncation | https://github.com/piotrmurach/strings-truncation | lib/strings/truncation.rb | Ruby | mit | 48 | master | 10,953 | # frozen_string_literal: true
require "forwardable"
require "strscan"
require "strings-ansi"
require "unicode/display_width"
require_relative "truncation/configuration"
require_relative "truncation/version"
module Strings
class Truncation
class Error < StandardError; end
ANSI_REGEXP = /#{Strings::ANSI::A... |
github | piotrmurach/strings-truncation | https://github.com/piotrmurach/strings-truncation | lib/strings/truncation/extensions.rb | Ruby | mit | 48 | master | 322 | # frozen_string_literal: true
require_relative "../truncation"
module Strings
class Truncation
module Extensions
refine String do
def truncate(*args, **options)
Strings::Truncation.truncate(self, *args, **options)
end
end
end # Extensions
end # Truncation
end # String... |
github | piotrmurach/strings-truncation | https://github.com/piotrmurach/strings-truncation | lib/strings/truncation/configuration.rb | Ruby | mit | 48 | master | 2,767 | # frozen_string_literal: true
module Strings
class Truncation
# A configuration object used by a Strings::Truncation instance
#
# @api private
class Configuration
DEFAULT_LENGTH = 30
DEFAULT_OMISSION = "…"
DEFAULT_POSITION = 0
# Create a configuration
#
# @api p... |
github | piotrmurach/strings-truncation | https://github.com/piotrmurach/strings-truncation | spec/spec_helper.rb | Ruby | mit | 48 | master | 707 | # 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... |
github | piotrmurach/strings-truncation | https://github.com/piotrmurach/strings-truncation | spec/unit/extensions_spec.rb | Ruby | mit | 48 | master | 491 | # frozen_string_literal: true
require "strings/truncation/extensions"
using Strings::Truncation::Extensions
RSpec.describe Strings::Truncation::Extensions do
it "truncates a string to a given length" do
expect("I try all things, I achieve what I can.".truncate(15))
.to eq("I try all thin…")
end
it "... |
github | piotrmurach/strings-truncation | https://github.com/piotrmurach/strings-truncation | spec/unit/truncate_ansi_spec.rb | Ruby | mit | 48 | master | 10,001 | # frozen_string_literal: true
RSpec.describe Strings::Truncation, "truncates ansi" do
it "doesn't truncate string matching length" do
text = "\e[32mHello\e[0m\e[34m\e[0m"
expect(Strings::Truncation.truncate(text, 5)).to eq(text)
end
it "truncates string with ANSI characters within boundary" do
text ... |
github | piotrmurach/strings-truncation | https://github.com/piotrmurach/strings-truncation | spec/unit/truncate_spec.rb | Ruby | mit | 48 | master | 11,944 | # frozen_string_literal: true
RSpec.describe Strings::Truncation, "#truncate" do
it "doesn't truncate for nil length and returns the original text" do
text = "It is not down on any map; true places never are."
expect(Strings::Truncation.truncate(text, nil)).to eq(text)
end
it "truncates to length of 0 ... |
github | piotrmurach/strings-truncation | https://github.com/piotrmurach/strings-truncation | spec/unit/truncate_multibyte_spec.rb | Ruby | mit | 48 | master | 10,776 | # frozen_string_literal: true
RSpec.describe Strings::Truncation, "truncate multibyte" do
context "when two characters display length and without space" do
let(:text) { "ラドクリフ、マラソン五輪代表に1万出場にも含み" }
it "doesn't truncate string matching length" do
text = "こんにちは"
expect(Strings::Truncation.truncate(... |
github | piotrmurach/strings-truncation | https://github.com/piotrmurach/strings-truncation | spec/unit/configure_spec.rb | Ruby | mit | 48 | master | 2,560 | # frozen_string_literal: true
RSpec.describe Strings::Truncation, "#configure" do
it "defaults configuration values" do
strings = described_class.new
expect(strings.configuration.length).to eq(30)
expect(strings.configuration.omission).to eq("…")
expect(strings.configuration.position).to eq(0)
e... |
github | piotrmurach/strings-truncation | https://github.com/piotrmurach/strings-truncation | spec/perf/truncate_spec.rb | Ruby | mit | 48 | master | 995 | # frozen_string_literal: true
require "rspec-benchmark"
require "active_support/core_ext/string/filters"
RSpec.describe Strings::Truncation do
include RSpec::Benchmark::Matchers
it "truncates text slower than ActiveSupport" do
text = "It is not down on any map; true places never are."
expect {
Stri... |
github | Overbryd/mite.cmd | https://github.com/Overbryd/mite.cmd | Gemfile | Ruby | mit | 48 | master | 239 | source :rubygems
gem 'activeresource', '~> 2.3'
gem 'activesupport', '~> 2.3'
gem 'mite-rb', '~> 0.4'
group :development, :test do
gem 'rake'
end
group :development do
gem 'jeweler'
end
group :test do
gem "rspec", "~> 1.3.2"
end |
github | Overbryd/mite.cmd | https://github.com/Overbryd/mite.cmd | Rakefile | Ruby | mit | 48 | master | 945 | require 'rubygems'
require 'rake'
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "mite.cmd"
gem.executables = "mite"
gem.summary = "A simple command line interface for basic mite tasks."
gem.email = "l.rieder@gmail.com"
gem.homepage = "http://github.com/Overbryd/mite.cmd"
ge... |
github | Overbryd/mite.cmd | https://github.com/Overbryd/mite.cmd | mite.cmd.gemspec | Ruby | mit | 48 | master | 2,303 | # 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{mite.cmd}
s.version = "0.1.12"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_ruby... |
github | Overbryd/mite.cmd | https://github.com/Overbryd/mite.cmd | spec/mite_ext_spec.rb | Ruby | mit | 48 | master | 3,283 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe Mite, 'account_url' do
it "should return the url for this account" do
Mite.account = 'demo'
Mite.account_url.should == '://demo.mite.yo.lk'
end
end
describe Mite::TimeEntry, 'formatted_time' do
it "should output minutes formatted... |
github | Overbryd/mite.cmd | https://github.com/Overbryd/mite.cmd | spec/mite_cmd_spec.rb | Ruby | mit | 48 | master | 1,448 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe MiteCmd, 'load_configuration' do
def fake_configuration
File.stub!(:exist?).and_return true
File.stub!(:read).and_return :yaml_data
YAML.stub!(:load).and_return({:account => 'demo', :apikey => '123'})
end
describe 'configur... |
github | Overbryd/mite.cmd | https://github.com/Overbryd/mite.cmd | spec/string_ext_spec.rb | Ruby | mit | 48 | master | 2,209 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe String, 'quote' do
it "should wrap a string in quotes" do
'Gimme quotes'.quote.should == '"Gimme quotes"'
end
end
describe String, 'quote_if_spaced' do
it "should wrap a string in quotes if it contains spaces" do
'I want quotes'.... |
github | Overbryd/mite.cmd | https://github.com/Overbryd/mite.cmd | spec/mite_cmd/autocomplete_spec.rb | Ruby | mit | 48 | master | 3,656 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe MiteCmd::Autocomplete, 'new' do
it "should set calling_script" do
autocomplete = MiteCmd::Autocomplete.new('/usr/local/bin/mite')
autocomplete.instance_variable_get('@calling_script').should == '/usr/local/bin/mite'
end
end
desc... |
github | Overbryd/mite.cmd | https://github.com/Overbryd/mite.cmd | spec/mite_cmd/application_spec.rb | Ruby | mit | 48 | master | 22,064 | require File.dirname(__FILE__) + '/../spec_helper'
describe MiteCmd::Application, 'new' do
it "should load the configuration for MiteCmd" do
MiteCmd.should_receive(:load_configuration)
MiteCmd::Application.new []
end
it "should not load the configuration if the first argument is 'configure'" do
Mi... |
github | Overbryd/mite.cmd | https://github.com/Overbryd/mite.cmd | lib/mite_cmd.rb | Ruby | mit | 48 | master | 801 | require 'yaml'
Dir[File.join(File.dirname(__FILE__), *%w[.. vendor * lib])].each do |path|
$LOAD_PATH.unshift path
end
require 'mite-rb'
require 'string_ext'
require 'mite_ext'
require 'mite_cmd/application'
require 'mite_cmd/autocomplete'
module MiteCmd
BASH_COMPLETION = "complete -C \"mite auto-complete\" mite"... |
github | Overbryd/mite.cmd | https://github.com/Overbryd/mite.cmd | lib/string_ext.rb | Ruby | mit | 48 | master | 1,329 | String.class_eval do
def quote(q="\"")
"#{q}#{self}#{q}"
end
def quote_if_spaced(q="\"")
self =~ /\s/ ? self.quote : self
end
def close_unmatched_quotes(q="\"")
(self.scan(/"/).size % 2) != 0 ? self+q : self
end
BASH_COLOR = {
:black => 30,
:red => 31,
:green => 32,
:y... |
github | Overbryd/mite.cmd | https://github.com/Overbryd/mite.cmd | lib/mite_ext.rb | Ruby | mit | 48 | master | 1,296 | Mite.class_eval do
def self.account_url
host_format % [protocol, domain_format % account, (port.blank? ? '' : ":#{port}")]
end
end
Mite::TimeEntry.class_eval do
# I need the full class path, otherwise there will be LoadErrors
def service
@service ||= Mite::Service.find(service_id) unless service_id.bla... |
github | Overbryd/mite.cmd | https://github.com/Overbryd/mite.cmd | lib/mite_cmd/application.rb | Ruby | mit | 48 | master | 6,620 | require 'ftools'
module MiteCmd
class Application
TIME_FORMAT = /^(\d+(\.\d+)?:?\+?)|(\d+:\d+\+?)|\+$/
FLIRTS = [
'I like your hairstyle.', 'What a nice console you have.', 'My favorite color is red on black, monospaced.',
"What a lovely operation system this #{`uname`} is.", 'What about dinner t... |
github | Overbryd/mite.cmd | https://github.com/Overbryd/mite.cmd | lib/mite_cmd/autocomplete.rb | Ruby | mit | 48 | master | 1,206 | require 'shellwords'
module MiteCmd
class Autocomplete
include Shellwords
attr_accessor :completion_table
attr_reader :calling_script
def initialize(calling_script)
@calling_script = calling_script
end
def bash_line
ENV['COMP_LINE'].to_s
end
def argument_... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | Rakefile | Ruby | mit | 48 | master | 359 | require "bundler"
Bundler::GemHelper.install_tasks
require "rake"
require "rake/extensiontask"
require "rspec/core/rake_task"
Dir[File.expand_path('../tasks/**/*.rake', __FILE__)].each {|f| load f }
Rake::ExtensionTask.new('mxnet')
Rake::ExtensionTask.new('mxnet/narray_helper')
RSpec::Core::RakeTask.new(:spec)
task... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | mxnet.gemspec | Ruby | mit | 48 | master | 1,167 | # coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "mxnet/version"
Gem::Specification.new do |spec|
spec.name = "mxnet"
spec.version = MXNet::VERSION
spec.authors = ["Kenta Murata"]
spec.email = ["mrkn@mrkn.jp"... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | ci/Rakefile | Ruby | mit | 48 | master | 503 | namespace :ci do
def get_image_name
ruby_version = ENV['ruby_version'] || '2.5.1'
python_version = ENV['python_version'] || '3.7.0'
mxnet_version = ENV['mxnet_version'] || '1.2.1.post1'
return ['mrkn/mxnet-rb-ci', [ruby_version, python_version, mxnet_version].join('-')].join(':')
end
task :pull d... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | example/mlp_scratch/mlp_scratch.rb | Ruby | mit | 48 | master | 3,070 | require 'mxnet'
module MLPScratch
ND = MXNet::NDArray
class MLP
def initialize(num_inputs: 784, num_outputs: 10, num_hidden_units: [256, 128, 64], ctx: nil)
@layer_dims = [num_inputs, *num_hidden_units, num_outputs]
@weight_scale = 0.01
@ctx = ctx || MXNet::Context.default
@all_paramet... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | example/mlp_scratch/mnist_scratch.rb | Ruby | mit | 48 | master | 1,690 | require_relative 'mlp_scratch'
require 'optparse'
require 'pathname'
options = {
batch_size: 256,
gpu_id: nil,
data_dir: Dir.pwd
}
OptionParser.new do |opt|
opt.banner = "Usage: #{opt.program_name} [options] [DATA_DIR]"
opt.on('-b BATCH_SIZE', '--batch-size', Integer, 'Specify learning batch size') {|v| opt... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | ext/mxnet/extconf.rb | Ruby | mit | 48 | master | 229 | require 'mkmf'
headers = []
if have_header('stdint.h')
headers << 'stdint.h'
end
have_type('int8_t', headers)
have_type('int16_t', headers)
have_type('int32_t', headers)
have_type('int64_t', headers)
create_makefile('mxnet') |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | ext/mxnet/narray_helper/extconf.rb | Ruby | mit | 48 | master | 216 | require 'mkmf'
require 'numo/narray'
$LOAD_PATH.each do |x|
if File.exist? File.join(x, 'numo/numo/narray.h')
$INCFLAGS = "-I#{x}/numo " + $INCFLAGS
break
end
end
create_makefile('mxnet/narray_helper') |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/spec_helper.rb | Ruby | mit | 48 | master | 396 | require "bundler/setup"
require "mxnet"
require_relative 'support/tmpdir'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_pat... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/op_info_spec.rb | Ruby | mit | 48 | master | 570 | require 'spec_helper'
module MXNet
::RSpec.describe OpInfo do
describe '.lookup' do
specify do
expect {
desc = OpInfo.lookup(MXNet::Symbol::Ops, :zeros_like)
expect(desc.name).to eq(:zeros_like)
}.not_to raise_error
end
specify do
expect {
... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/gluon_spec.rb | Ruby | mit | 48 | master | 17,774 | require 'spec_helper'
require 'mxnet/gluon'
RSpec.describe MXNet::Gluon do
describe 'parameter_sharing' do
let(:namespace) { Module.new }
before do
class namespace::Net < MXNet::Gluon::Block
def initialize(**kwargs)
super
with_name_scope do
self[:dense0] = MXNe... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/lr_scheduler_spec.rb | Ruby | mit | 48 | master | 3,631 | require 'spec_helper'
RSpec.describe MXNet::LRScheduler::FactorScheduler do
specify do
lrsched = MXNet::LRScheduler::FactorScheduler.new(step: 10, factor: 0.2)
lrsched.base_lr = 0.1
expect(lrsched.step).to eq(10)
expect(lrsched.factor).to eq(0.2)
expect(lrsched.count).to eq(0)
expect(lrsched... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/dtype_spec.rb | Ruby | mit | 48 | master | 1,456 | require 'spec_helper'
RSpec.describe MXNet::DType do
describe '.id2name' do
def id2name(id)
MXNet::DType.id2name(id)
end
specify do
expect(id2name(0)).to eq(:float32)
end
end
describe '.name2id' do
def name2id(name)
MXNet::DType.name2id(name)
end
specify do
... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/initializer_spec.rb | Ruby | mit | 48 | master | 1,632 | require 'spec_helper'
require 'mxnet/initializer'
RSpec.describe MXNet::Init do
describe '.create' do
it 'does not accept a class' do
expect {
MXNet::Init.create(MXNet::Init::Zero)
}.to raise_error(ArgumentError)
end
it 'accepts an instance and returns it' do
init0 = MXNet::Init... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/cached_op_spec.rb | Ruby | mit | 48 | master | 915 | require 'spec_helper'
RSpec.describe MXNet::CachedOp do
describe '.new' do
let(:sym) do
MXNet::Symbol.var('sym')
end
it 'accepts keyword arguments' do
expect{MXNet::CachedOp.new(sym, static_alloc: 1)}.not_to raise_error
expect{MXNet::CachedOp.new(sym, data_indices: [0])}.not_to raise_e... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/random_spec.rb | Ruby | mit | 48 | master | 909 | require 'spec_helper'
module MXNet
::RSpec.describe NDArray::Random do
describe 'uniform' do
specify do
ary = NDArray.zeros([10])
NDArray::Random.uniform(2, 5, out: ary)
expect(ary.to_a).to be_all {|x| 2 <= x && x < 5 }
end
specify do
low = NDArray.zeros([2])
... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/optimizer_spec.rb | Ruby | mit | 48 | master | 4,113 | require 'spec_helper'
RSpec.describe MXNet::Optimizer do
describe '.create' do
it 'does not accept a class' do
expect {
MXNet::Optimizer.create(MXNet::Optimizer::SGD)
}.to raise_error(ArgumentError)
end
it 'accepts an instance' do
opt = MXNet::Optimizer.create(MXNet::Optimizer::... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/metric_spec.rb | Ruby | mit | 48 | master | 1,475 | require 'spec_helper'
RSpec.describe MXNet::Metric::Accuracy do
specify do
predicts = [MXNet::NDArray.array([[0.3, 0.7], [0, 1], [0.4, 0.6]])]
labels = [MXNet::NDArray.array([0, 1, 1])]
acc = MXNet::Metric::Accuracy.new
acc.update(labels, predicts)
expect(acc.get).to match([:accuracy, a_value_wit... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/registry_spec.rb | Ruby | mit | 48 | master | 4,960 | require 'spec_helper'
RSpec.describe MXNet::Registry::Manager do
let(:namespace) { Module.new }
before do
class namespace::TestClass
def initialize(*args, **kwargs)
@args = args
@params = kwargs
end
attr_reader :args, :params
end
class namespace::TestSubclass1 < nam... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/autograd_spec.rb | Ruby | mit | 48 | master | 3,658 | require 'spec_helper'
RSpec.describe MXNet::Autograd do
describe '#record' do
specify do
expect { |b| MXNet::Autograd.record(&b) }.to yield_control
end
end
describe '.mark_variables' do
context 'first argument' do
it 'must be Array' do
expect{MXNet::Autograd.mark_variables(0, [])... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/context_spec.rb | Ruby | mit | 48 | master | 592 | require 'spec_helper'
RSpec.describe MXNet::Context do
describe '#==' do
specify do
x = MXNet::Context.new(:cpu)
expect(x).to eq(MXNet::Context.new(:cpu))
end
end
describe '.with' do
specify do
ctx = MXNet::gpu(0)
expect {|b| MXNet::Context.with(ctx, &b) }.to yield_with_args(... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/utils_spec.rb | Ruby | mit | 48 | master | 988 | require 'spec_helper'
module MXNet
::RSpec.describe Utils do
describe '.decompose_slice' do
def decompose_slice(slice_like)
MXNet::Utils.decompose_slice(slice_like)
end
specify do
expect(decompose_slice(0..1)).to eq([0, 2, nil])
expect(decompose_slice(0...1)).to eq([0, ... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/ndarray_spec.rb | Ruby | mit | 48 | master | 42,623 | require 'spec_helper'
module MXNet
::RSpec.describe NDArray do
describe '.new' do
specify do
expect { MXNet::NDArray.new }.to raise_error(NoMethodError)
end
end
describe '#[]' do
context 'when the array is 1D' do
specify do
x = MXNet::NDArray.zeros([3])
... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/symbol_spec.rb | Ruby | mit | 48 | master | 20,114 | require 'spec_helper'
module MXNet
::RSpec.describe Symbol do
let(:nd_ones) { MXNet::NDArray.ones([2, 3]) }
describe '.new' do
specify do
expect { MXNet::Symbol.new(0) }.to raise_error(NoMethodError, /private method/)
end
end
describe '.var' do
specify do
x = MXNet... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/narray_helper/ndarray_spec.rb | Ruby | mit | 48 | master | 4,389 | require 'spec_helper'
require 'numo/narray'
module MXNet
::RSpec.describe NDArray do
describe '#[]=' do
xspecify do
nd = MXNet::NDArray.arange(20, dtype: :float32).reshape([4, 5])
nary = Numo::Int32.new(2, 3).fill(100)
nd[1..2, 1..3] = nary # TODO: support this
expect(nd.to_... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/ndarray/utils_spec.rb | Ruby | mit | 48 | master | 1,569 | require 'spec_helper'
RSpec.describe MXNet::NDArray do
describe '.save and .load', :within_tmpdir do
context 'when the data is a NDArray' do
specify do
data = MXNet::NDArray.array([[1, 2], [3, 4]])
MXNet::NDArray.save('ndarray', data)
expect(File.file?('ndarray')).to eq(true)
... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/name/name_manager_spec.rb | Ruby | mit | 48 | master | 1,581 | require 'spec_helper'
RSpec.describe MXNet::Name::NameManager do
subject(:name_manager) do
MXNet::Name::NameManager.new
end
describe '#get' do
specify do
expect(subject.get('foo', 'bar')).to eq('foo')
expect(subject.get(nil, 'bar')).to eq('bar0')
expect(subject.get(nil, 'bar')).to eq('... |
github | mrkn/mxnet.rb | https://github.com/mrkn/mxnet.rb | spec/mxnet/gluon/loss_spec.rb | Ruby | mit | 48 | master | 1,869 | require 'spec_helper'
require 'mxnet/gluon/loss'
RSpec.describe MXNet::Gluon::Loss::L1Loss do
describe '#[]' do
let(:loss) do
described_class.new
end
it 'calculates L1 loss' do
prediction = MXNet::NDArray.array([1])
label = MXNet::NDArray.array([2])
expect(loss.(prediction, label... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.