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
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/remessa/cnab400/sicredi.rb
Ruby
mit
19
master
11,921
# -*- encoding: utf-8 -*- module BrBoleto module Remessa module Cnab400 class Sicredi < BrBoleto::Remessa::Cnab400::Base def conta_class BrBoleto::Conta::Sicredi end ############################# HEADER ######################################## # Código da remessa # Tipo: Numérico ...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/remessa/cnab400/banco_brasil.rb
Ruby
mit
19
master
10,744
# -*- encoding: utf-8 -*- module BrBoleto module Remessa module Cnab400 class BancoBrasil < BrBoleto::Remessa::Cnab400::Base def conta_class BrBoleto::Conta::BancoBrasil end ############################## HEADER ###################################### # Código da remessa # Tipo: Numérico ...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/remessa/cnab400/bradesco.rb
Ruby
mit
19
master
11,248
# -*- encoding: utf-8 -*- module BrBoleto module Remessa module Cnab400 class Bradesco < BrBoleto::Remessa::Cnab400::Base def conta_class BrBoleto::Conta::Bradesco end validate :validation_codigo_empresa_is_required ############################## HEADER #########################################...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/remessa/cnab400/santander.rb
Ruby
mit
19
master
8,906
# -*- encoding: utf-8 -*- module BrBoleto module Remessa module Cnab400 class Santander < BrBoleto::Remessa::Cnab400::Base def conta_class BrBoleto::Conta::Santander end ########## VALIDAÇÕES ESPECÍFICAS DESTE OBJETO PARA A CONTA ############ def valid_codigo_transmissao_required; true end # ...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/remessa/cnab400/itau.rb
Ruby
mit
19
master
7,473
# -*- encoding: utf-8 -*- module BrBoleto module Remessa module Cnab400 class Itau < BrBoleto::Remessa::Cnab400::Base def conta_class BrBoleto::Conta::Itau end ############################## HEADER ###################################### # Código da remessa # Tipo: Numérico # Tamanho:...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/remessa/cnab400/unicred.rb
Ruby
mit
19
master
8,205
# -*- encoding: utf-8 -*- module BrBoleto module Remessa module Cnab400 # A Unicred (CobExpress) utiliza o layout de boleto e os arquivos de remessa/retorno disponibilizados pelo Banco Bradesco. class Unicred < BrBoleto::Remessa::Cnab400::Base def conta_class BrBoleto::Conta::Unicred end ######...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/remessa/cnab400/caixa.rb
Ruby
mit
19
master
8,251
# -*- encoding: utf-8 -*- module BrBoleto module Remessa module Cnab400 class Caixa < BrBoleto::Remessa::Cnab400::Base def conta_class BrBoleto::Conta::Caixa end ############################## HEADER ###################################### # Código da remessa # Tipo: Numérico # Tamanh...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/remessa/cnab400/helper/detalhe.rb
Ruby
mit
19
master
4,571
module BrBoleto module Remessa module Cnab400 module Helper module Detalhe # Monta o registro segmento P do arquivo # # @param pagamento [BrBoleto::Remessa::Pagamento] # objeto contendo os detalhes do boleto (valor, vencimento, sacado, etc) # @param nr_lote [Integer] # numero...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/remessa/cnab400/helper/trailer.rb
Ruby
mit
19
master
1,378
module BrBoleto module Remessa module Cnab400 module Helper module Trailer # Monta o registro trailer do arquivo # # @param nro_lotes [Integer] # numero de lotes no arquivo # @param sequencial [Integer] # numero de registros(linhas) no arquivo # # @return [String] ...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/remessa/cnab400/helper/header.rb
Ruby
mit
19
master
3,009
module BrBoleto module Remessa module Cnab400 module Helper module Header # Monta o registro header do arquivo # # @return [String] # def monta_header header = '' # TAMANHO INFORMAÇÃO header << header_posicao_001_a_001 # 001 Código do re...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/conta/cecred.rb
Ruby
mit
19
master
3,688
# encoding: utf-8 module BrBoleto module Conta class Cecred < BrBoleto::Conta::Base # MODALIDADE CARTEIRA: # _________________________________________________________ # | Carteira | Descrição | # | 1 | Com Cadastramento (Cobrança Registrada) | ...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/conta/sicredi.rb
Ruby
mit
19
master
13,606
# encoding: utf-8 module BrBoleto module Conta class Sicredi < BrBoleto::Conta::Base # MODALIDADE CARTEIRA: # _______________________________________________ # | Carteira | Descrição | # | 1 | Cobrança Simples Com registro | # | 3 | Cobrança S...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/conta/santander.rb
Ruby
mit
19
master
14,457
# encoding: utf-8 module BrBoleto module Conta class Santander < BrBoleto::Conta::Base # MODALIDADE CARTEIRA: # ___________________________________________ # | Carteira | Descrição | # | 101 | Cobrança Simples com registro | # | 102 | Cobrança Simples sem registro...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/conta/sicoob.rb
Ruby
mit
19
master
3,924
# encoding: utf-8 module BrBoleto module Conta class Sicoob < BrBoleto::Conta::Base # MODALIDADE # O banco siccob utiliza a combinação da carteira e modalidade para # saber se é um pagamento com registro, sem registrou ou caucionada. # Carteira / Modalidade = Tipo de pagamento # 1 / 01...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/conta/itau.rb
Ruby
mit
19
master
35,063
# encoding: utf-8 module BrBoleto module Conta class Itau < BrBoleto::Conta::Base # MODALIDADE CARTEIRA: # _______________________________________________________________________ # | Carteira | Descrição | # | 104 | Escritural Eletrônica - C...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/conta/banco_brasil.rb
Ruby
mit
19
master
17,829
# encoding: utf-8 module BrBoleto module Conta class BancoBrasil < BrBoleto::Conta::Base # MODALIDADE CARTEIRA: # _________________________________________________________________ # | Carteira | Descrição | # | 11 | Cobrança Simples - Com Reg...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/conta/unicred.rb
Ruby
mit
19
master
1,380
# encoding: utf-8 module BrBoleto module Conta # A Unicred (através do CobExpress) utiliza e o layout de boleto os arquivos de remessa/retorno disponibilizados pelo Banco Bradesco. class Unicred < BrBoleto::Conta::Bradesco def default_values super.merge({ carteira: '09', }) end def nom...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/conta/bradesco.rb
Ruby
mit
19
master
15,043
# encoding: utf-8 module BrBoleto module Conta class Bradesco < BrBoleto::Conta::Base # MODALIDADE CARTEIRA: # _______________________________________________ # | Carteira | Descrição | # | 06 | Sem registro | # | 09 | Com regi...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/conta/caixa.rb
Ruby
mit
19
master
13,621
# encoding: utf-8 module BrBoleto module Conta class Caixa < BrBoleto::Conta::Base # MODALIDADE CARTEIRA # Opcoes: # 14: Cobrança Simples com registro # 24: Cobrança Simples sem registro # # Carteira/Modalidade: # 1/4 = Registrada / Emissão do boleto(4-Beneficiário) # 2/4...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/conta/base.rb
Ruby
mit
19
master
12,487
# encoding: utf-8 module BrBoleto module Conta class Base < BrBoleto::ActiveModelBase include BrBoleto::Calculos include BrBoleto::Helper::DefaultCodes # ATRIBUTOS # razao_social # cpf_cnpj # convenio OU codigo_cedente OU codigo_beneficiario # convenio OU codigo_cedente_dv OU ...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/calculos/linha_digitavel.rb
Ruby
mit
19
master
7,360
# encoding: utf-8 require 'active_support/core_ext/object' module BrBoleto module Calculos # Representação numérica do código de barras, mais conhecida como linha digitável! :p # # A representação numérica do código de barras é composta, por cinco campos. # Sendo os três primeiros campos, amarrados p...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/calculos/modulo11_fator_de9a2_resto_x.rb
Ruby
mit
19
master
1,588
module BrBoleto module Calculos # === Módulo 11 Fator de 9 a 2 - Resto 10, sendo X # <b>Essa classe difere da outra com Modulo11FatorDe9a2, no momento de verificar o resto da divisão por 11.</b> # # <b>Para mais detalhes veja a classe Modulo11FatorDe9a2.</b> # # ==== Exemplo 10 como resto da ...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/calculos/modulo11.rb
Ruby
mit
19
master
1,481
module BrBoleto module Calculos # Classe que possue a convenção de calculo do modulo 11. # O que muda para cada classe é a forma de verificar o total do cálculo. # # @abstract Precisa implementar { #fatores, #calculate } nas subclasses. # class Modulo11 < String # Número que será feito o cálculo do módu...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/calculos/modulo10.rb
Ruby
mit
19
master
2,488
# encoding: utf-8 module BrBoleto module Calculos # === Cálculo do Modulo 10 # # === Passos # # 1) Multiplica-se cada algarismo do campo pela seqüência de multiplicadores <b>2, 1, 2, 1, 2, 1 ...</b>, posicionados da direita para a esquerda. # # 2) Some individualmente, os algarismos dos re...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/calculos/modulo11_fator_de2a7.rb
Ruby
mit
19
master
3,050
module BrBoleto module Calculos # === Módulo 11 Fator de 2 a 7 # # === Passos # # 1) Tomando-se os algarismos multiplique-os, iniciando-se da direita para a esquerda, # pela seqüência numérica de 2 a 7 (2, 3, 4, 5, 6, 7 ... e assim por diante). # # 2) Some o resultado de cada produto e...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/calculos/fator_vencimento.rb
Ruby
mit
19
master
4,774
# encoding: utf-8 module BrBoleto module Calculos # Classe responsável pelo cálculo de Fator de Vencimento do boleto bancário. # # === Descricão # # Conforme Carta-circular 002926 do Banco Central do Brasil, de 24/07/2000, recomenda-se a indicação do Fator de Vencimento no Código de Barras. # ...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/calculos/modulo11_fator3197.rb
Ruby
mit
19
master
2,622
module BrBoleto module Calculos # === Módulo 11 Fator 3197 # # === Passos # # 1) Tomando-se os algarismos multiplique-os, iniciando-se da direita para a esquerda, # pela seqüência numérica (3, 1, 9 ,7, 3, 1, 9 ,7 ... e assim por diante). # # 2) Some o resultado de cada produto efetuado...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/calculos/modulo11_fator_de9a2.rb
Ruby
mit
19
master
1,942
module BrBoleto module Calculos # === Módulo 11 Fator de 9 a 2 # # === Passos # # 1) Tomando-se os algarismos multiplique-os, iniciando-se da direita para a esquerda, # pela seqüência numérica de 9 a 2 (9, 8, 7, 6, 5, 4, 3, 2 ... e assim por diante). # # 2) Some o resultado de cada pro...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/calculos/fatores_de_multiplicacao.rb
Ruby
mit
19
master
2,367
# encoding: utf-8 module BrBoleto module Calculos # Classe responsável por multiplicar cada dígito pelos fatores de multiplicação passado como argumento. # # Imagine que temos o número <b>'2468'</b> e os fatores de multiplicação <b>[2, 1]</b>. # # Será calculado da seguinte maneira: # # ...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/calculos/modulo_numero_de_controle.rb
Ruby
mit
19
master
4,022
module BrBoleto module Calculos # === Cálculo do Módulo do Número de Controle (2 dígitos) # # Tipo de cálculo usado pelo Banco Banrisul. # # === Cálculo do Primeiro Dígito # # 1) Multiplica-se cada algarismo do campo pela seqüência de multiplicadores <b>2, 1, 2, 1, 2, 1 ...</b>, posicionad...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/calculos/digitos.rb
Ruby
mit
19
master
888
# encoding: utf-8 require 'active_support/core_ext/enumerable' module BrBoleto module Calculos # Classe responsável por lidar com os dígitos dos módulos. # class Digitos # @param [Integer] number Número que servirá para os cálculo com os dígitos desse número. # def initialize(number) ...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/calculos/modulo11_fator_de2a9.rb
Ruby
mit
19
master
2,452
# encoding: utf-8 module BrBoleto module Calculos # === Módulo 11 Fator de 2 a 9 # # === Passos # # 1) Tomando-se os algarismos multiplique-os, iniciando-se da direita para a esquerda, # pela seqüência numérica de 2 a 9 (2, 3, 4, 5, 6, 7, 8, 9 ... e assim por diante). # # 2) Some o res...
github
Brunomm/br_boleto
https://github.com/Brunomm/br_boleto
lib/br_boleto/calculos/modulo11_fator_de2a9_resto_zero.rb
Ruby
mit
19
master
1,046
module BrBoleto module Calculos # Classe responsável por calcular o módulo 11 com fatores de 2 a 9. # <b>Essa classe difere da outra com Modulo11FatorDe2a9, no momento de verificar o resto da divisão por 11.</b> # # <b>Para mais detalhes veja a classe Modulo11FatorDe2a9.</b> # class Modulo11Fa...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
on_what.rb
Ruby
mit
19
master
393
# NOTE: Very simple tests for what system we are on, extracted for sharing # between Rakefile, gemspec, and spec_helper. Not for use in actual library. # This is copied from https://github.com/ms-ati/docile/blob/master/on_what.rb def on_travis? ENV['CI'] == 'true' end def on_jruby? defined?(RUBY_ENGINE) && 'jru...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
dsl_maker.gemspec
Ruby
mit
19
master
1,410
require File.expand_path('on_what', File.dirname(__FILE__)) $:.push File.expand_path('../lib', __FILE__) require 'dsl/maker/version' Gem::Specification.new do |s| s.name = 'dsl_maker' s.version = DSL::Maker::VERSION s.author = 'Rob Kinyon' s.email = 'rob.kinyon@gmail.com' s.summary = 'Easy multi-level ...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
Gemfile
Ruby
mit
19
master
287
require File.expand_path('on_what', File.dirname(__FILE__)) source 'https://rubygems.org' # Travis-only dependencies go here if on_travis? && !on_1_8? group :test do gem 'codecov', '>= 0.0.9', :require => false end end # Specify gem's dependencies in dsl_maker.gemspec gemspec
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
Rakefile
Ruby
mit
19
master
893
require 'rake/clean' require 'bundler/gem_tasks' require 'rubygems/tasks' require 'rspec/core/rake_task' # This is used by the Yardoc stuff in docile's Rakefile. We're not there yet. require File.expand_path('on_what', File.dirname(__FILE__)) # Default task for `rake` is to run rspec task :default => [:spec] # Use d...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
lib/dsl/maker.rb
Ruby
mit
19
master
16,248
require 'dsl/maker/version' require 'docile' # Children of DSL::Maker are the "control class". All of the classes that inherit # from DSL::Maker::Base are "dsl classes" - classes that are passed to Docile and # which represent levels of the DSL. In order for :parse_dsl/:execute_dsl to # return back the accumulated va...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
spec/hash_type_spec.rb
Ruby
mit
19
master
1,298
# This is to test the Hash type. describe 'Hash type' do context 'as an element' do let (:dsl_class) { Class.new(DSL::Maker) do add_entrypoint(:person, { :name => String, :tags => Hash, }) do Structs::Taggable.new(name, tags) end end } it...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
spec/class_as_subdsl_spec.rb
Ruby
mit
19
master
2,153
# This is testing the ability to pass a class into generate_dsl and it # does the right thing. describe "Passing a class into generate_dsl" do it "can do it" do wheel_dsl = Class.new(DSL::Maker) do add_entrypoint(:wheel, { :size => Integer, :maker => String, }) do |*args| defa...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
spec/functions_spec.rb
Ruby
mit
19
master
2,727
describe 'Functions in the DSL' do dsl_class = Class.new(DSL::Maker) do add_entrypoint(:person, { :name => String, :child => generate_dsl({ :name => String, }) { Structs::Person.new(name) }, }) do Structs::Person.new(name, child) end end it 'can call a fu...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
spec/error_spec.rb
Ruby
mit
19
master
5,477
# This verifies the various error-handling situations. describe "DSL::Maker validation" do it "requires a block for :generate_dsl" do expect { Class.new(DSL::Maker) do add_entrypoint(:first, { :second => generate_dsl({}) }) {} end }.to raise_error('Block required for gen...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
spec/spec_helper.rb
Ruby
mit
19
master
1,071
require File.expand_path('on_what', File.dirname(File.dirname(__FILE__))) RSpec.configure do |config| config.expect_with :rspec do |c| c.syntax = :expect end end unless on_1_8? begin require 'simplecov' SimpleCov.configure do add_filter '/spec/' add_filter '/vendor/' minimum_cover...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
spec/multi_level_spec.rb
Ruby
mit
19
master
5,236
# This will use a DSL that parses a family tree. # # Notes: # 1. Because we're creating classes on the fly, we must fully-qualify the Boolean # class name. If we created real classes, the context would be provided for us. describe 'A multi-level DSL making family-trees' do it "can handle a simple single-level parse o...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
spec/multiple_invocation_spec.rb
Ruby
mit
19
master
2,427
# This will use a DSL that defines Structs::Cars describe "A DSL describing cars used with multiple invocations" do it "returns two items in the right order" do dsl_class = Class.new(DSL::Maker) do add_entrypoint(:car, { :maker => DSL::Maker::Any, }) do Structs::Car.new(maker) e...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
spec/args_spec.rb
Ruby
mit
19
master
4,602
# This will use a DSL that defines fruit describe "A DSL with argument handling describing fruit" do describe "with one argument in add_entrypoint" do let(:dsl_class) { Class.new(DSL::Maker) do add_entrypoint(:fruit, { :name => String, }) do |*args| default(:name, args, ...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
spec/alias_type_spec.rb
Ruby
mit
19
master
2,303
# This is to test the AliasOf(:name) type describe "Packager DSL AliasOf" do # This uses $toppings defined in spec/spec_helper.rb def verify_pizza(pizza, values={}) expect(pizza).to be_instance_of(Structs::Pizza) $toppings.each do |topping| expect(pizza.send(topping)).to eq(values[topping]) end ...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
spec/single_level_spec.rb
Ruby
mit
19
master
5,182
# This will use the pizza-maker DSL from Docile's documentation. # @sauce_level = :extra # pizza do # cheese yes # pepperoni yes # sauce @sauce_level # end #=> #<Pizza:0x00001009dc398 @cheese=true, @pepperoni=true, @bacon=false, @sauce=:extra> # Notes: # 1. Because we're creating classes on the fly, we must full...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
spec/array_type_spec.rb
Ruby
mit
19
master
3,592
describe "Packager DSL ArrayOf" do # This uses $toppings defined in spec/spec_helper.rb def verify_pizza(pizza, values={}) expect(pizza).to be_instance_of(Structs::Pizza) $toppings.each do |topping| expect(pizza.send(topping)).to eq(values[topping]) end end context "can array a String" do ...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
spec/helper_spec.rb
Ruby
mit
19
master
1,976
# This uses a DSL that also provides a set of useful helpers. # describe 'A DSL with helpers' do context '#add_helper' do it "can add a helper that's useful" do dsl_class = Class.new(DSL::Maker) do add_entrypoint(:car, { :maker => String, }) do Structs::Car.new(maker) ...
github
robkinyon/ruby-dsl-maker
https://github.com/robkinyon/ruby-dsl-maker
spec/validation_spec.rb
Ruby
mit
19
master
1,512
# These are tests about the validation process for DSL::Maker describe "Validations" do it "validates entrypoint-specific items" do dsl_class = Class.new(DSL::Maker) do toppings_dsl = generate_dsl({ :cheese => DSL::Maker::Boolean, :bacon => DSL::Maker::Boolean, :pepperoni => DSL::Ma...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
Rakefile
Ruby
mit
19
master
1,251
require 'spec/rake/spectask' task :default => :spec Spec::Rake::SpecTask.new do |t| t.ruby_opts = ["-rubygems"] t.libs << 'lib' t.warning = false t.rcov = false t.spec_opts = ["--colour"] end require 'rake/rdoctask' Rake::RDocTask.new do |rdoc| if File.exist?('VERSION') version = File.read('VERSION'...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
tuio-ruby.gemspec
Ruby
mit
19
master
1,998
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{tuio-ruby} s.version = "0.2.5" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
lib/tuio-ruby.rb
Ruby
mit
19
master
219
require 'tuio-ruby/tuio_cursor_parameter' require 'tuio-ruby/tuio_object_parameter' require 'tuio-ruby/tuio_container' require 'tuio-ruby/tuio_cursor' require 'tuio-ruby/tuio_object' require 'tuio-ruby/tuio_client'
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
lib/tuio-ruby/tuio_container.rb
Ruby
mit
19
master
1,446
require File.join( File.dirname( __FILE__ ), 'tuio_point' ) class TuioContainer < TuioPoint attr_accessor :session_id, :x_pos, :y_pos, :x_speed, :y_speed, :motion_accel def initialize( session_id, x_pos, y_pos ) super( x_pos, y_pos ) @session_id = session_id @x_speed = 0.0 @y_speed = 0.0 @...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
lib/tuio-ruby/tuio_object_parameter.rb
Ruby
mit
19
master
559
require File.join( File.dirname( __FILE__ ), 'tuio_parameter' ) # /tuio/2Dobj set s i x y a X Y A m r class TuioObjectParameter < TuioParameter attr_reader :angle, :fiducial_id, :rotation_vector, :rotation_accel def initialize( session_id, fiducial_id, x_pos, y_pos, angle, x_speed, y_speed, rotation_vector, mo...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
lib/tuio-ruby/tuio_parameter.rb
Ruby
mit
19
master
454
class TuioParameter attr_accessor :session_id, :x_pos, :y_pos, :x_speed, :y_speed, :motion_accel def self.new_from_initial_params( session_id, x_pos, y_pos ) new session_id, x_pos, y_pos, 0.0, 0.0, 00 end def initialize( session_id, x_pos, y_pos, x_speed, y_speed, motion_accel ) @session_id = sess...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
lib/tuio-ruby/tuio_object.rb
Ruby
mit
19
master
1,316
require File.join( File.dirname( __FILE__ ), 'tuio_container' ) class TuioObject < TuioContainer attr_reader :angle, :fiducial_id, :rotation_vector, :rotation_accel def self.from_params( params ) new( params.session_id, params.fiducial_id, params.x_pos, params.y_pos, params.angle...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
lib/tuio-ruby/tuio_cursor.rb
Ruby
mit
19
master
525
require File.join( File.dirname( __FILE__ ), 'tuio_container' ) class TuioCursor < TuioContainer attr_accessor :finger_id attr_reader :x_speed, :y_speed, :motion_accel def self.from_params( params ) new( params.session_id, params.x_pos, params.y_pos ) end def initializ...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
lib/tuio-ruby/tuio_client.rb
Ruby
mit
19
master
3,752
require 'osc-ruby' # core exts require 'tuio-ruby/core_ext/object' require 'tuio-ruby/core_ext/float' class TuioClient include OSC attr_reader :tuio_objects, :tuio_cursors client_events :object_creation, :object_update, :object_removal client_events :cursor_creation, :cursor_update, :cursor_removal def i...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
lib/tuio-ruby/tuio_point.rb
Ruby
mit
19
master
954
class TuioPoint attr_accessor :x_pos, :y_pos, :updated_at def initialize( x_pos, y_pos ) @x_pos, @y_pos = x_pos, y_pos end def update( x_pos, y_pos ) @x_pos, @y_pos = x_pos, y_pos clear_update_time end def distance_to( another_point ) dx = @x_pos - another_point.x_pos dy = @y...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
lib/tuio-ruby/core_ext/object.rb
Ruby
mit
19
master
855
# this is a little meta magic to clean up some of the repetition in the client # i noticed that i kept making the same similiar methods for each event such as # # client_events :object_creation # # which causes these two methods to be created # def on_object_creation( &object_creation_blk ) # @object_creation_callbac...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
examples/tuio_dump.rb
Ruby
mit
19
master
756
require 'rubygems' require 'osc-ruby' $:.unshift( File.join( File.dirname( __FILE__ ), '..', 'lib' )) require 'tuio-ruby' @tc = TuioClient.new @tc.on_object_creation do | to | puts "New TUIO Object at x: #{to.x_pos}, y: #{to.y_pos}" end @tc.on_object_update do | to | puts "Updated TUIO Object #{to.fiducial_id} ...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
spec/spec_helper.rb
Ruby
mit
19
master
541
require 'osc-ruby' require 'tuio-ruby' require 'spec' # monkey patch to get at osc core to send messages class TuioClient def osc @osc end end # helper method for integration tests def send_message( pattern, *msg ) osc_msg = OSC::Message.new( pattern, nil, *msg) @server.osc.send( :sendmesg, osc_msg ) end...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
spec/unit/tuio_cursor_spec.rb
Ruby
mit
19
master
816
require File.join( File.dirname(__FILE__) , '..', 'spec_helper' ) describe TuioCursor do before :each do @args1 = [ @session_id = 42, @x_pos = 0.8, @y_pos = 0.4, @x_speed = 0.01, @y_speed = 0.03, @motion_accel = 0.02 ] @params = TuioCursorParameter.new( *@args1 ) @...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
spec/unit/tuio_cursor_parameter_spec.rb
Ruby
mit
19
master
945
require File.join( File.dirname(__FILE__) , '..', 'spec_helper' ) require File.join( File.dirname(__FILE__) , 'tuio_parameter_spec' ) # /tuio/2Dcur set s x y X Y m describe TuioObjectParameter do describe "cursor creation" do before :each do args = [ @session_id = 12, @x_pos = 0.1, ...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
spec/unit/tuio_object_parameter_spec.rb
Ruby
mit
19
master
918
require File.join( File.dirname(__FILE__) , '..', 'spec_helper' ) require File.join( File.dirname(__FILE__) , 'tuio_parameter_spec' ) # /tuio/2Dobj set s i x y a X Y A m r # /tuio/2Dcur set s x y X Y m describe TuioObjectParameter do before :each do args = [ @session_id = 12, @fiducial_id = 41, ...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
spec/unit/tuio_object_spec.rb
Ruby
mit
19
master
2,188
require File.join( File.dirname(__FILE__) , '..', 'spec_helper' ) describe TuioObject do before :each do @args1 = [ @session_id = 42, @fiducial_id = 1, @x_pos = 0.8, @y_pos = 0.4, @angle = 1, @x_speed = 0.1, @y_speed = 0.2, @rotation_vector = 0.11, @motion_ac...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
spec/unit/tuio_parameter_spec.rb
Ruby
mit
19
master
733
require File.join( File.dirname(__FILE__) , '..', 'spec_helper' ) # /tuio/2Dobj set s i x y a X Y A m r # /tuio/2Dcur set s x y X Y m # session_id, x, y, X, Y, m shared_examples_for "TuioParameter" do it "should fetch session id" do @tuio_param.session_id.should == @session_id end it "should fetch x p...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
spec/unit/tuio_point_spec.rb
Ruby
mit
19
master
1,181
require File.join( File.dirname(__FILE__) , '..', 'spec_helper' ) describe TuioPoint do before :each do @location1 = [0.1, 0.1] @location2 = [0.1, 0.21] @point1 = TuioPoint.new( *@location1 ) @point2 = TuioPoint.new( *@location2 ) end describe "in general" do it "should know the dista...
github
aberant/tuio-ruby
https://github.com/aberant/tuio-ruby
spec/integration/tuio_event_spec.rb
Ruby
mit
19
master
5,194
require File.join( File.dirname(__FILE__) , '..', 'spec_helper' ) describe "tuio object" do before :each do setup_server end describe "in general" do it "should call the creation hook" do @server.on_object_creation do | object | raise "creation hook called!" if object.session_id == 49 ...
github
knaveofdiamonds/harken
https://github.com/knaveofdiamonds/harken
Rakefile
Ruby
mit
19
master
1,227
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Run unit tests' task :default => :test desc 'Run unit tests' Rake::TestTask.new(:test) do |t| t.pattern = 'test/test_*.rb' t.verbose = true end desc 'Generate project documentation' Rake::RDocTask.new(:doc) do |rdoc| rdoc.rdoc_dir = 'doc' r...
github
knaveofdiamonds/harken
https://github.com/knaveofdiamonds/harken
lib/responder.rb
Ruby
mit
19
master
1,662
module Harken # Base class for responding to messages directed at the chat room bot. # This should be subclassed and appropriate actions to be listened to # defined with <code>listen</code>. # # A hello world example: # # class Hello < Harken::Responder # listen "greet <person>" do |m| # ...
github
knaveofdiamonds/harken
https://github.com/knaveofdiamonds/harken
lib/message.rb
Ruby
mit
19
master
10,581
module Harken module Message include Treetop::Runtime def root @root || :message end module Message0 def interpret(vars=[]) regex = Regexp.compile("^" + elements.map {|e| e.interpret(vars) }.join + "$") eigenclass = (class << regex; self; end) eigenclass.send(:define_method, :variables) do ...
github
knaveofdiamonds/harken
https://github.com/knaveofdiamonds/harken
lib/parser_ext.rb
Ruby
mit
19
master
645
# Extensions to Syntax nodes and the treetop-generated parser. module Harken module PassThroughInterpret # :nodoc: all # Make every node in the syntax tree respond to "interpret" def interpret(vars=[]) elements.map {|e| e.interpret(vars) }.join if nonterminal? end end Treetop::Runtime::SyntaxNo...
github
knaveofdiamonds/harken
https://github.com/knaveofdiamonds/harken
lib/bot.rb
Ruby
mit
19
master
3,101
module Harken # A simple XMPP bot. This wraps the xmpp4r client library and provides a # simple interface. # # This bot is mainly intended to provide an interface to other non-room related # systems via defined Responders, so there are lots of room interactions that # you can't do with this bot (setting the...
github
knaveofdiamonds/harken
https://github.com/knaveofdiamonds/harken
lib/harken.rb
Ruby
mit
19
master
243
root = File.expand_path(File.dirname(__FILE__)) require 'xmpp4r' require 'xmpp4r/muc' require 'treetop' require "#{root}/message" require "#{root}/parser_ext" require "#{root}/responder" require "#{root}/responder_group" require "#{root}/bot"
github
knaveofdiamonds/harken
https://github.com/knaveofdiamonds/harken
lib/responder_group.rb
Ruby
mit
19
master
587
module Harken # Allows you to compose Responders into a group. class ResponderGroup # Creates a new ResponderGroup. # # Can be constructed with specific Responder classes or, if left blank # every loaded Responder will be composed. def initialize(*klasses) klasses = Responder.all if klasse...
github
knaveofdiamonds/harken
https://github.com/knaveofdiamonds/harken
test/test_message_parser.rb
Ruby
mit
19
master
3,402
require File.dirname(__FILE__) + '/helper' class TestMessageParser < Test::Unit::TestCase def setup @parser = Harken::MessageParser.new end def test_string result = @parser.interpret("Hello, world!") assert result.match("Hello, world!") assert ! result.match("foo") end def test_identifier ...
github
knaveofdiamonds/harken
https://github.com/knaveofdiamonds/harken
test/dummy_responders.rb
Ruby
mit
19
master
279
class SimpleResponder < Harken::Responder listen "test" do "foo" end listen "test <variable>" do |m| "value is '#{m.variable}'" end end class DuplicateResponder < Harken::Responder listen "test" do "first" end listen "test" do "second" end end
github
knaveofdiamonds/harken
https://github.com/knaveofdiamonds/harken
test/helper.rb
Ruby
mit
19
master
238
$:.unshift(File.expand_path(File.dirname(__FILE__) + "/..")) require 'test/unit' require 'treetop' require 'polyglot' require 'src/message' require 'lib/parser_ext' require 'lib/bot' require 'lib/responder' require 'lib/responder_group'
github
knaveofdiamonds/harken
https://github.com/knaveofdiamonds/harken
test/test_responder.rb
Ruby
mit
19
master
744
require File.dirname(__FILE__) + '/helper' require File.dirname(__FILE__) + '/dummy_responders' class TestResponder < Test::Unit::TestCase def test_simple_responder_responds_to_message assert_equal ["foo"], SimpleResponder.new.receive("test") end def test_simple_responder_ignores_message assert_equal []...
github
knaveofdiamonds/harken
https://github.com/knaveofdiamonds/harken
test/test_responder_group.rb
Ruby
mit
19
master
600
require File.dirname(__FILE__) + '/helper' require File.dirname(__FILE__) + '/dummy_responders' class TestResponder < Test::Unit::TestCase def test_responder_group_composes_all_responders_by_default replies = Harken::ResponderGroup.new.receive("test") assert replies.include?("foo") assert replies.include...
github
knaveofdiamonds/harken
https://github.com/knaveofdiamonds/harken
test/test_bot.rb
Ruby
mit
19
master
445
require File.dirname(__FILE__) + '/helper' class TestBot < Test::Unit::TestCase def test_bot_complains_if_you_dont_provide_user_and_host assert_raise(RuntimeError) { Harken::Bot.new } assert_raise(RuntimeError) { Harken::Bot.new(:user => "roland") } assert_raise(RuntimeError) { Harken::Bot.new(:host => "...
github
MicahChalmer/mr-sparkle
https://github.com/MicahChalmer/mr-sparkle
mr-sparkle.gemspec
Ruby
mit
19
master
1,808
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'mr-sparkle/version' Gem::Specification.new do |gem| gem.name = "mr-sparkle" gem.version = Mr::Sparkle::VERSION gem.authors = ["Micah Chalmer"] gem.email ...
github
MicahChalmer/mr-sparkle
https://github.com/MicahChalmer/mr-sparkle
lib/mr-sparkle.rb
Ruby
mit
19
master
2,984
require_relative "mr-sparkle/version" require 'listen' module Mr module Sparkle DEFAULT_RELOAD_PATTERN = /\.(?:builder|coffee|creole|css|erb|erubis|haml|html|js|less|liquid|mab|markdown|md|mdown|mediawiki|mkd|mw|nokogiri|radius|rb|rdoc|rhtml|ru|sass|scss|str|textile|txt|wiki|yajl|yml)$/ DEFAULT_FULL_RELOAD...
github
MicahChalmer/mr-sparkle
https://github.com/MicahChalmer/mr-sparkle
lib/mr-sparkle/unicorn.conf.rb
Ruby
mit
19
master
200
worker_processes 1 GC.respond_to?(:copy_on_write_friendly=) and GC.copy_on_write_friendly = true before_fork do |server, worker| require 'bundler' Bundler.require(:default, ENV["RACK_ENV"]) end
github
MicahChalmer/mr-sparkle
https://github.com/MicahChalmer/mr-sparkle
spec/full_reload_spec.rb
Ruby
mit
19
master
2,103
require_relative 'spec_helper' VENDOR_GEM_CODE_PATH = 'vendor/full_reload_test_gem/lib/full_reload_test_gem.rb' INITIAL_STRING = "This file was not watched.\nThis string is from a gem." describe "App Runner: Full Reloading" do before do self.app_template_path = app_template_fixture("full_reload") end it "d...
github
MicahChalmer/mr-sparkle
https://github.com/MicahChalmer/mr-sparkle
spec/load_rack_env_spec.rb
Ruby
mit
19
master
776
require_relative 'spec_helper' describe "App Runner: Loading bundler groups based on RACK_ENV" do before do self.app_template_path = app_template_fixture("load_rack_env_group") end it "loads the group whose name is specified by RACK_ENV" do start_app({'RACK_ENV'=>'foo'}) app_request('/').body.must_e...
github
MicahChalmer/mr-sparkle
https://github.com/MicahChalmer/mr-sparkle
spec/normal_running_spec.rb
Ruby
mit
19
master
532
require_relative 'spec_helper' describe "App Runner: Normal Operation" do before do self.app_template_path = app_template_fixture('hello') end it "runs the application" do start_app app_request('/').body.must_match(/^Hello, world!/) end it "reloads the application when a ruby file changes" do ...
github
MicahChalmer/mr-sparkle
https://github.com/MicahChalmer/mr-sparkle
spec/spec_helper.rb
Ruby
mit
19
master
4,316
require 'minitest/autorun' require 'minitest/reporters' require 'minitest/around' require 'net/http' require 'tmpdir' require 'timeout' require 'bundler' MiniTest::Reporters.use! MiniTest::Reporters::SpecReporter.new # Max # of seconds to wait before declaring the test failed WAIT_TIMEOUT=10 class ServerAppTest < Mi...
github
chriseppstein/extract-sass-vars
https://github.com/chriseppstein/extract-sass-vars
extract-sass-vars.gemspec
Ruby
mit
19
master
800
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'extract-sass-vars/version' Gem::Specification.new do |gem| gem.name = "extract-sass-vars" gem.version = Extract::Sass::Vars::VERSION gem.authors = ["Chris Epp...
github
chriseppstein/extract-sass-vars
https://github.com/chriseppstein/extract-sass-vars
lib/extract-sass-vars.rb
Ruby
mit
19
master
822
require 'sass' require "extract-sass-vars/version" # We need access to the environment's children created in the perform visitor class Sass::Environment attr_accessor :children alias old_initialize initialize def initialize(parent = nil, options = nil) old_initialize(parent,options) self.children = [] ...
github
jch/em-irc
https://github.com/jch/em-irc
Gemfile
Ruby
mit
19
master
408
source 'http://rubygems.org' # Specify your gem's dependencies in em-irc.gemspec gemspec group :development do gem 'yard' gem 'redcarpet' gem 'guard' gem 'guard-rspec' gem 'guard-bundler' end group :development, :test do gem 'pry' gem 'rake' gem 'rspec', "~> 2" end group :darwin do gem 'rb-fsevent...
github
jch/em-irc
https://github.com/jch/em-irc
Rakefile
Ruby
mit
19
master
311
#!/usr/bin/env rake require "bundler/gem_tasks" Bundler::GemHelper.install_tasks require 'rspec/core/rake_task' RSpec::Core::RakeTask.new('spec') do |t| t.rspec_opts = '--tag ~integration' end RSpec::Core::RakeTask.new('spec:ci') do |t| t.pattern = 'spec/integration/*_spec.rb' end task :default => :spec
github
jch/em-irc
https://github.com/jch/em-irc
Guardfile
Ruby
mit
19
master
466
# A sample Guardfile # More info at https://github.com/guard/guard#readme guard 'bundler' do watch('Gemfile') end guard 'rspec', :version => 2, :cli => '--tag ~integration' do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } watch('lib/em-irc.rb') { "spec" ...
github
jch/em-irc
https://github.com/jch/em-irc
em-irc.gemspec
Ruby
mit
19
master
887
# -*- encoding: utf-8 -*- require File.expand_path('../lib/em-irc/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Jerry Cheung"] gem.email = ["jch@whatcodecraves.com"] gem.description = %q{em-irc is an IRC client that uses EventMachine to handle connections to servers} gem.s...
github
jch/em-irc
https://github.com/jch/em-irc
examples/logger.rb
Ruby
mit
19
master
318
require File.expand_path '../../lib/em-irc', __FILE__ require 'logger' client = EventMachine::IRC::Client.new do host '127.0.0.1' port '6667' on :connect do puts 'client connected' nick 'em-irc' join "#general" end on :raw do |m| puts "raw message: #{m.inspect}" end end client.run!
github
jch/em-irc
https://github.com/jch/em-irc
examples/interactive.rb
Ruby
mit
19
master
689
require File.expand_path '../../lib/em-irc', __FILE__ require 'logger' client = EventMachine::IRC::Client.new do host '127.0.0.1' port '6667' on :connect do nick 'keybot' join "#general" end on :raw do |m| puts "raw message: #{m.inspect}" end end class KeyboardHandler < EM::Connection ...
github
jch/em-irc
https://github.com/jch/em-irc
spec/integration/integration_spec.rb
Ruby
mit
19
master
2,248
require 'spec_helper' # add a raw message queue for debugging, might be a good normal feature class TestClient < EventMachine::IRC::Client def initialize(options = {}) super(options) @received_messages = [] end def receive_data(data) @received_messages << data super(data) end def history ...