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 | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/asn1/ecdsa_sig_value.rb | Ruby | mit | 19 | main | 436 | # typed: strict
# frozen_string_literal: true
module Paseto
module ASN1
class ECDSASigValue < T::Struct
extend T::Sig
const :r, OpenSSL::BN
const :s, OpenSSL::BN
sig { returns(OpenSSL::ASN1::Sequence) }
def build
OpenSSL::ASN1::Sequence.new(
[
OpenSSL... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/asn1/ecdsa_full_r.rb | Ruby | mit | 19 | main | 552 | # typed: strict
# frozen_string_literal: true
module Paseto
module ASN1
class ECDSAFullR < T::Struct
extend T::Sig
const :r, OpenSSL::PKey::EC::Point
const :s, OpenSSL::BN
sig { returns(OpenSSL::ASN1::Sequence) }
def build
# Unsupported by OpenSSL 3.0
# :nocov:
... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/asn1/one_asymmetric_key.rb | Ruby | mit | 19 | main | 696 | # typed: strict
# frozen_string_literal: true
module Paseto
module ASN1
class OneAsymmetricKey < T::Struct
extend T::Sig
const :version, OpenSSL::BN
const :algorithm, PrivateKeyAlgorithmIdentifier
const :private_key, PrivateKey
const :public_key, T.nilable(PublicKey)
sig { r... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/asn1/ec_private_key.rb | Ruby | mit | 19 | main | 505 | # typed: strict
# frozen_string_literal: true
module Paseto
module ASN1
class ECPrivateKey < T::Struct
extend T::Sig
const :private_key, String
sig { returns(OpenSSL::ASN1::Sequence) }
def build
OpenSSL::ASN1::Sequence.new(
[
OpenSSL::ASN1::Integer.new(1),
... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/asn1/ecdsa_signature.rb | Ruby | mit | 19 | main | 1,387 | # typed: strict
# frozen_string_literal: true
module Paseto
module ASN1
class ECDSASignature < T::Struct
extend T::Sig
const :signature, T.any(ECDSASigValue, ECDSAFullR)
sig { params(bytes: String, part_len: Integer).returns(ECDSASignature) }
def self.from_rs(bytes, part_len)
r ... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/serializer/optional_json.rb | Ruby | mit | 19 | main | 728 | # typed: strict
# frozen_string_literal: true
module Paseto
module Serializer
module OptionalJson
extend T::Sig
extend Interface::Serializer
sig { override.params(val: String, options: T::Hash[T.untyped, T.untyped]).returns(T.untyped) }
def self.deserialize(val, options)
obj = M... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/serializer/raw.rb | Ruby | mit | 19 | main | 547 | # typed: strict
# frozen_string_literal: true
module Paseto
module Serializer
module Raw
extend T::Sig
extend Interface::Serializer
sig(:final) do
override.params(
val: String,
_options: T::Hash[T.untyped, T.untyped]
).returns(T.any(String, T::Hash[String, ... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/operations/i_d.rb | Ruby | mit | 19 | main | 1,195 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Operations
class ID
extend T::Sig
sig(:final) { params(key: SymmetricKey).returns(String) }
def self.lid(key)
new(key.protocol).lid(key)
end
sig(:final) { params(key: AsymmetricKey).retur... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/operations/pke.rb | Ruby | mit | 19 | main | 1,551 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Operations
class PKE
extend T::Sig
sig { params(sealing_key: AsymmetricKey).void }
def initialize(sealing_key)
@sealing_key = sealing_key
@coder = T.let(@sealing_key.pke, Paseto::Interface::PK... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/operations/pbkw.rb | Ruby | mit | 19 | main | 2,258 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Operations
class PBKW
DOMAIN_SEPARATOR_ENCRYPT = T.let("\xFF", String)
DOMAIN_SEPARATOR_AUTH = T.let("\xFE", String)
extend T::Sig
sig { params(key: Interface::Key, password: String, options: T::Hash[S... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/operations/wrap.rb | Ruby | mit | 19 | main | 842 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Operations
class Wrap
extend T::Sig
DOMAIN_SEPARATOR_AUTH = "\x81"
DOMAIN_SEPARATOR_ENCRYPT = "\x80"
sig { params(wrapping_key: SymmetricKey, paserk: [String, String, String, String]).returns(Interface... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/operations/pke/p_k_ev4.rb | Ruby | mit | 19 | main | 2,897 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Operations
class PKE
class PKEv4
extend T::Sig
include Interface::PKE
sig { override.returns(String) }
attr_reader :header
sig { override.returns(Protocol::Version4) }
at... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/operations/pke/p_k_ev3.rb | Ruby | mit | 19 | main | 2,956 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Operations
class PKE
class PKEv3
extend T::Sig
include Interface::PKE
sig { override.returns(Protocol::Version3) }
attr_reader :protocol
sig { override.returns(String) }
... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/operations/pbkd/p_b_k_dv4.rb | Ruby | mit | 19 | main | 2,944 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Operations
module PBKD
class PBKDv4
extend T::Sig
include Interface::PBKD
sig { override.returns(Protocol::Version4) }
attr_reader :protocol
sig { params(password: String).void }... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/operations/pbkd/p_b_k_dv3.rb | Ruby | mit | 19 | main | 2,417 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Operations
module PBKD
class PBKDv3
extend T::Sig
include Interface::PBKD
sig { override.returns(Protocol::Version3) }
attr_reader :protocol
sig { params(password: String).void }... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/operations/id/i_dv4.rb | Ruby | mit | 19 | main | 341 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Operations
class ID
module IDv4
extend T::Sig
extend Interface::ID
sig { override.returns(Protocol::Version4) }
def self.protocol
Protocol::Version4.instance
end
e... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/operations/id/i_dv3.rb | Ruby | mit | 19 | main | 341 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Operations
class ID
module IDv3
extend T::Sig
extend Interface::ID
sig { override.returns(Protocol::Version3) }
def self.protocol
Protocol::Version3.instance
end
e... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/protocol/version3.rb | Ruby | mit | 19 | main | 2,689 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Protocol
class Version3
extend T::Sig
extend T::Helpers
include Singleton
include Interface::Version
sig(:final) { override.params(key: String, nonce: String, payload: String).returns(String) }
... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/protocol/version4.rb | Ruby | mit | 19 | main | 2,690 | # typed: strict
# frozen_string_literal: true
module Paseto
module Protocol
class Version4
extend T::Sig
extend T::Helpers
include Singleton
include Interface::Version
sig(:final) { override.params(key: String, nonce: String, payload: String).returns(String) }
def crypt(key:... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/interface/version.rb | Ruby | mit | 19 | main | 1,891 | # typed: strict
# frozen_string_literal: true
module Paseto
module Interface
module Version
extend T::Sig
extend T::Helpers
include Comparable
abstract!
sig { abstract.params(key: String, nonce: String, payload: String).returns(String) }
def crypt(key:, nonce:, payload:); e... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/interface/i_d.rb | Ruby | mit | 19 | main | 527 | # typed: strict
# frozen_string_literal: true
module Paseto
module Interface
module ID
extend T::Sig
extend T::Helpers
abstract!
sig(:final) { params(type: String, paserk: String).returns(String) }
def encode(type, paserk)
header = "#{protocol.paserk_version}.#{type}."
... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/interface/serializer.rb | Ruby | mit | 19 | main | 468 | # typed: strict
# frozen_string_literal: true
module Paseto
module Interface
module Serializer
extend T::Sig
extend T::Helpers
interface!
sig { abstract.params(val: String, options: T::Hash[T.untyped, T.untyped]).returns(T.untyped) }
def deserialize(val, options); end
sig {... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/interface/pie.rb | Ruby | mit | 19 | main | 961 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Interface
module PIE
extend T::Sig
extend T::Helpers
abstract!
sig { abstract.params(nonce: String).returns(String) }
def authentication_key(nonce:); end
sig { abstract.params(payload: Str... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/interface/pbkd.rb | Ruby | mit | 19 | main | 1,669 | # typed: strict
# frozen_string_literal: true
module Paseto
module Interface
module PBKD
extend T::Sig
extend T::Helpers
abstract!
sig do
abstract.params(
header: String,
pre_key: String,
salt: String,
nonce: String,
edk: String,... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/interface/pke.rb | Ruby | mit | 19 | main | 1,348 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Interface
module PKE
extend T::Sig
extend T::Helpers
abstract!
DOMAIN_SEPARATOR_ENCRYPT = "\x01"
DOMAIN_SEPARATOR_AUTH = "\x02"
sig { abstract.params(xk: String, epk: T.untyped).returns(St... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/interface/key.rb | Ruby | mit | 19 | main | 3,319 | # encoding: binary
# typed: true
# frozen_string_literal: true
module Paseto
module Interface
class Key
extend T::Sig
extend T::Helpers
DOMAIN_SEPARATOR_AUTH = "\x81"
DOMAIN_SEPARATOR_ENCRYPT = "\x80"
abstract!
sig do
abstract.params(
payload: T::Hash[Stri... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/interface/wrapper.rb | Ruby | mit | 19 | main | 436 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Interface
module Wrapper
extend T::Sig
extend T::Helpers
interface!
sig { abstract.params(key: Key, nonce: T.nilable(String)).returns(String) }
def encode(key, nonce: nil); end
sig { abstr... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/wrappers/pie.rb | Ruby | mit | 19 | main | 1,775 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Wrappers
class PIE
extend T::Sig
include Interface::Wrapper
sig { params(wrapping_key: SymmetricKey).void }
def initialize(wrapping_key)
@wrapping_key = wrapping_key
@coder = T.let(wrap... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/wrappers/pie/pie_v3.rb | Ruby | mit | 19 | main | 2,086 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Wrappers
class PIE
class PieV3
extend T::Sig
include Interface::PIE
DOMAIN_SEPARATOR_AUTH = "\x81"
DOMAIN_SEPARATOR_ENCRYPT = "\x80"
sig { override.returns(String) }
attr... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/wrappers/pie/pie_v4.rb | Ruby | mit | 19 | main | 2,108 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module Wrappers
class PIE
class PieV4
extend T::Sig
include Interface::PIE
DOMAIN_SEPARATOR_AUTH = "\x81"
DOMAIN_SEPARATOR_ENCRYPT = "\x80"
sig { override.returns(Protocol::Version4) }
... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/v4/local.rb | Ruby | mit | 19 | main | 1,706 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module V4
# PASETOv4 `local` token interface providing symmetric encryption of tokens.
class Local < SymmetricKey
extend T::Sig
final!
sig(:final) { override.returns(Protocol::Version4) }
attr_reader :pro... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/v4/public.rb | Ruby | mit | 19 | main | 6,081 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module V4
# PASETOv4 `public` token interface providing asymmetric signature signing and verification of tokens.
class Public < AsymmetricKey
extend T::Sig
extend T::Helpers
final!
# Number of bytes in an... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/verifiers/footer.rb | Ruby | mit | 19 | main | 714 | # typed: strict
# frozen_string_literal: true
module Paseto
module Verifiers
class Footer < T::Enum
extend T::Sig
enums do
ForbiddenWPKValue = new
ForbiddenKIDValue = new
end
sig { params(footer: T::Hash[String, T.untyped], options: T::Hash[Symbol, T.untyped]).void }
... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/verifiers/payload.rb | Ruby | mit | 19 | main | 1,179 | # typed: strict
# frozen_string_literal: true
module Paseto
module Verifiers
class Payload < T::Enum
extend T::Sig
enums do
Audience = new
IssuedAt = new
Issuer = new
Expiration = new
NotBefore = new
Subject = new
TokenIdentifier = new
en... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/v3/public.rb | Ruby | mit | 19 | main | 5,328 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module V3
# PASETOv3 `public` token interface providing asymmetric signature signing and verification of tokens.
class Public < AsymmetricKey
extend T::Sig
extend T::Helpers
final!
# Size of (r || s) in a... |
github | bannable/paseto | https://github.com/bannable/paseto | lib/paseto/v3/local.rb | Ruby | mit | 19 | main | 2,005 | # encoding: binary
# typed: strict
# frozen_string_literal: true
module Paseto
module V3
# PASETOv3 `local` token interface providing symmetric encryption of tokens.
class Local < SymmetricKey
extend T::Sig
extend T::Helpers
# Size in bytes of a SHA384 digest
SHA384_DIGEST_LEN = 48
... |
github | glejeune/syncftp | https://github.com/glejeune/syncftp | Rakefile | Ruby | mit | 19 | master | 1,584 | require 'rubygems'
require 'rake'
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "syncftp"
gem.summary = %Q{Sync via FTP, only modified files}
gem.description = %Q{Sync via FTP, only modified files}
gem.email = "gregoire.lejeune@free.fr"
gem.homepage = "http://github.com/glejeun... |
github | glejeune/syncftp | https://github.com/glejeune/syncftp | syncftp.gemspec | Ruby | mit | 19 | master | 1,803 | # 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{syncftp}
s.version = "0.0.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubyge... |
github | glejeune/syncftp | https://github.com/glejeune/syncftp | test/helper.rb | Ruby | mit | 19 | master | 240 | require 'rubygems'
require 'test/unit'
require 'shoulda'
require 'fakefs/safe'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'syncftp'
class Test::Unit::TestCase
end |
github | glejeune/syncftp | https://github.com/glejeune/syncftp | test/test_syncftp.rb | Ruby | mit | 19 | master | 275 | require 'helper'
class TestSyncftp < Test::Unit::TestCase
context "A User story" do
setup do
@sync = SyncFTP.new( 'localhost', :username => 'greg', :password => 'mcag71139' )
end
should "be initialized" do
assert_not_nil @sync
end
end
end |
github | glejeune/syncftp | https://github.com/glejeune/syncftp | lib/syncftp.rb | Ruby | mit | 19 | master | 7,869 | # Copyright (c) 2009 Gregoire Lejeune
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
#... |
github | hanklords/shared-mime-info | https://github.com/hanklords/shared-mime-info | shared-mime-info.gemspec | Ruby | isc | 19 | master | 849 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{shared-mime-info}
s.version = "0.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Mael Clerambault"]
s.date = %q{2009-02-15}
s.email = %q{mael@clerambault.fr}
s.fil... |
github | hanklords/shared-mime-info | https://github.com/hanklords/shared-mime-info | Rakefile | Ruby | isc | 19 | master | 852 | require 'rake/rdoctask'
require 'rake/packagetask'
require 'rake/gempackagetask'
PKG_FILES = FileList["lib/*.rb", "Rakefile", "LICENSE", "README.rdoc"]
spec = Gem::Specification.new do |s|
s.summary = "Library to guess the MIME type of a file with both filename lookup and magic file detection"
s.name = "shared-mi... |
github | hanklords/shared-mime-info | https://github.com/hanklords/shared-mime-info | test.rb | Ruby | isc | 19 | master | 624 | # cvs -d:pserver:anoncvs@anoncvs.freedesktop.org:/cvs/mime co shared-mime-info/tests
$: << 'lib'
require 'lib/shared-mime-info'
File.foreach('shared-mime-info/tests/list') do |line|
next if line =~ /^#/ or line =~ /^$/
line.chomp!
file, type, test = line.split ' ', 3
n,d,f = (test || '').ljust(3, 'o').split(/... |
github | hanklords/shared-mime-info | https://github.com/hanklords/shared-mime-info | lib/magics.rb | Ruby | isc | 19 | master | 7,336 | # line 1 "magics.rl"
module MIME
module Magic
# line 7 "lib/magics.rb"
class << self
attr_accessor :_magic_actions
private :_magic_actions, :_magic_actions=
end
self._magic_actions = [
0, 1, 0, 1, 1, 1, 3, 1,
5, 1, 12, 1, 13, 2, 0, 1,
2, 2, 6, 2, 2, 7, 2, 2,
9, 2, 11, 12, 3, 2, 8, 4,
3, 2, 9, 13, 3, 2, 10, ... |
github | hanklords/shared-mime-info | https://github.com/hanklords/shared-mime-info | lib/shared-mime-info.rb | Ruby | isc | 19 | master | 9,071 | # Copyright (c) 2006 Mael Clerambault <mael@clerambault.fr>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE ... |
github | kucaahbe/cucumber-websteps | https://github.com/kucaahbe/cucumber-websteps | cucumber-websteps.gemspec | Ruby | mit | 19 | master | 1,210 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "cucumber/websteps/version"
Gem::Specification.new do |s|
s.name = "cucumber-websteps"
s.version = Cucumber::Websteps::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["kucaahbe"]
s.email = ["kucaahbe@... |
github | kucaahbe/cucumber-websteps | https://github.com/kucaahbe/cucumber-websteps | Rakefile | Ruby | mit | 19 | master | 811 | require 'bundler'
require 'cucumber'
require 'cucumber/rake/task'
Bundler::GemHelper.install_tasks
drivers = %w(rack_test selenium)
test_unit_framework = case RUBY_VERSION
when '1.8.7'
'test_unit'
when /^1\.9\.\d/
'minitest'
... |
github | kucaahbe/cucumber-websteps | https://github.com/kucaahbe/cucumber-websteps | features/support/paths.rb | Ruby | mit | 19 | master | 974 | module NavigationHelpers
# Maps a name to a path. Used by the
#
# When /^I go to (.+)$/ do |page_name|
#
# step definition in web_steps.rb
#
def path_to(page_name)
case page_name
when /^the home\s?page$/
'/'
when /^the congratulations page$/
'/congratulations'
when /^the oth... |
github | kucaahbe/cucumber-websteps | https://github.com/kucaahbe/cucumber-websteps | features/support/env.rb | Ruby | mit | 19 | master | 619 | # Generated by cucumber-sinatra. (Sat May 28 22:45:12 +0300 2011)
ENV['RACK_ENV'] = 'test'
require File.join(File.dirname(__FILE__), '..', '..', 'test/app.rb')
require 'capybara'
require 'capybara/cucumber'
Capybara.app = TestApp
Capybara.save_and_open_page_path = File.expand_path(File.join(File.dirname(__FILE__),'... |
github | kucaahbe/cucumber-websteps | https://github.com/kucaahbe/cucumber-websteps | features/support/selectors.rb | Ruby | mit | 19 | master | 1,020 | module HtmlSelectorsHelpers
# Maps a name to a selector. Used primarily by the
#
# When /^(.+) within (.+)$/ do |step, scope|
#
# step definitions in web_steps.rb
#
def selector_for(locator)
case locator
when "the page"
"html > body"
when "table's header"
"table tbody > tr th"
... |
github | kucaahbe/cucumber-websteps | https://github.com/kucaahbe/cucumber-websteps | test/app.rb | Ruby | mit | 19 | master | 426 | require 'sinatra/base'
class TestApp < Sinatra::Base
set :views, File.dirname(__FILE__) + '/views'
get '/' do
erb :home
end
get '/congratulations' do
@redirected = params.has_key?("redirected")
erb :congratulations
end
get '/other/page' do
redirect to('/congratulations?redirected=true')
... |
github | kucaahbe/cucumber-websteps | https://github.com/kucaahbe/cucumber-websteps | lib/_unsorted.rb | Ruby | mit | 19 | master | 1,310 | # TL;DR: YOU SHOULD DELETE THIS FILE
#
# This file was generated by Cucumber-Rails and is only here to get you a head start
# These step definitions are thin wrappers around the Capybara/Webrat API that lets you
# visit pages, interact with widgets and make assertions about page content.
#
# If you use these step defin... |
github | kucaahbe/cucumber-websteps | https://github.com/kucaahbe/cucumber-websteps | lib/cucumber/websteps.rb | Ruby | mit | 19 | master | 615 | require 'uri'
require 'cgi'
unless defined?(SUPPORT_DIR)
features_dir = caller.select { |path| path =~ /features/ }.first.split('/')
2.times { features_dir.pop }
SUPPORT_DIR = File.join(features_dir,'support')
end
require File.join(SUPPORT_DIR,'paths.rb')
require File.join(SUPPORT_DIR,'selectors.rb')
module Wi... |
github | kucaahbe/cucumber-websteps | https://github.com/kucaahbe/cucumber-websteps | lib/cucumber/websteps/browsing_steps.rb | Ruby | mit | 19 | master | 1,989 | Given /^(?:|I )am on (.+)$/ do |page_name|
visit path_to(page_name)
end
When /^(?:|I )go to (.+)$/ do |page_name|
visit path_to(page_name)
end
When /^(?:|I )follow "([^"]*)"$/ do |link|
click_link(link)
end
Then /^I should be redirected to (.+)$/ do |page|
puts 'TODO: make this done'
step "I should be on #... |
github | kucaahbe/cucumber-websteps | https://github.com/kucaahbe/cucumber-websteps | lib/cucumber/websteps/step_scoper.rb | Ruby | mit | 19 | master | 281 | # Single-line step scoper
When /^(.*) within ([^:]+)$/ do |step_def, parent|
with_scope(parent) { step step_def }
end
# Multi-line step scoper
When /^(.*) within ([^:]+):$/ do |step_def, parent, table_or_string|
with_scope(parent) { step "#{step_def}:", table_or_string }
end |
github | kucaahbe/cucumber-websteps | https://github.com/kucaahbe/cucumber-websteps | lib/cucumber/websteps/form_steps.rb | Ruby | mit | 19 | master | 5,615 | # Use this to fill in an entire form with data from a table. Example:
#
# When I fill in the following:
# | Account Number | 5002 |
# | Expiry date | 2009-11-01 |
# | Note | Nice guy |
# | Wants Email? | ... |
github | mattetti/merb_babel | https://github.com/mattetti/merb_babel | merb_babel.gemspec | Ruby | mit | 19 | master | 1,816 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{merb_babel}
s.version = "0.1.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Matt Aimonetti"]
s.date = %q{2009-01-17}
s.description = %q{Merb plugin that provides si... |
github | mattetti/merb_babel | https://github.com/mattetti/merb_babel | Rakefile | Ruby | mit | 19 | master | 1,397 | require 'rubygems'
require 'rake/gempackagetask'
require 'merb-core'
require 'merb-core/tasks/merb'
GEM_NAME = "merb_babel"
GEM_VERSION = "0.1.2"
AUTHOR = "Matt Aimonetti"
EMAIL = "mattaimonetti@gmail.com"
HOMEPAGE = "http://github.com/mattetti/merb_babel/"
SUMMARY = "Merb plugin that provides simple localization/int... |
github | mattetti/merb_babel | https://github.com/mattetti/merb_babel | spec/m_l10n_spec.rb | Ruby | mit | 19 | master | 1,993 | require File.dirname(__FILE__) + '/spec_helper'
describe "ML10n" do
before(:each) do
@lang_test_path = File.expand_path(File.dirname(__FILE__) + "/lang")
@lang_test_path_2 = File.expand_path(File.dirname(__FILE__) + "/other_lang_dir")
ML10n.reset_localization_files_and_dirs!
end
after(:each) do
... |
github | mattetti/merb_babel | https://github.com/mattetti/merb_babel | spec/locale_detector_spec.rb | Ruby | mit | 19 | master | 1,263 | require File.dirname(__FILE__) + '/spec_helper'
describe 'country detector' do
it "should detect country from request" do
c = dispatch_to(TestController, :index, {},
'HTTP_ACCEPT_LANGUAGE' => 'en-UK')
c.country.should == 'UK'
end
it "should detect language from request" do
c = dispatch_to(Test... |
github | mattetti/merb_babel | https://github.com/mattetti/merb_babel | spec/m_i18n_spec.rb | Ruby | mit | 19 | master | 2,577 | require File.dirname(__FILE__) + '/spec_helper'
describe '#babelize' do
before(:each) do
Merb::Controller.send :include, Merb::GlobalHelpers
@c = dispatch_to(TestController, :index)
ML10n.add_localization_dir(File.expand_path(File.dirname(__FILE__) + "/lang"))
ML10n.add_localization_dir(File.exp... |
github | mattetti/merb_babel | https://github.com/mattetti/merb_babel | spec/spec_helper.rb | Ruby | mit | 19 | master | 1,224 | $TESTING=true
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
require "rubygems"
require "spec"
require "merb-core"
require File.join(File.dirname(__FILE__), "..", 'lib', 'merb_babel')
default_options = {
:environment => 'test',
:adapter => 'runner',
:session_store => 'cookie',
:session_secret_key =... |
github | mattetti/merb_babel | https://github.com/mattetti/merb_babel | spec/merb_babel_spec.rb | Ruby | mit | 19 | master | 3,699 | require File.dirname(__FILE__) + '/spec_helper'
describe 'using set_locale before filter, ' do
describe 'a controller' do
describe 'locale' do
it "should be set by default" do
c = dispatch_to(TestController, :index)
c.locale.should == 'en-US'
end
it "should be able t... |
github | mattetti/merb_babel | https://github.com/mattetti/merb_babel | lib/merb_babel.rb | Ruby | mit | 19 | master | 1,872 | #require File.join(File.dirname(__FILE__) / "merb_babel" / "core_ext")
# make sure we're running inside Merb
if defined?(Merb::Plugins)
# Merb gives you a Merb::Plugins.config hash...feel free to put your stuff in your piece of it
Merb::Plugins.config[:merb_babel] = {
:default_locale => 'en-US',
:default_... |
github | mattetti/merb_babel | https://github.com/mattetti/merb_babel | lib/merb_babel/m_locale.rb | Ruby | mit | 19 | master | 3,163 | # The MLocale module helps you set up a locale, language, country
# You don't have to use a locale, in some cases you might just want to use the language
module MLocale
def locale_from_request
if hal = request.env["HTTP_ACCEPT_LANGUAGE"]
hal.gsub!(/\s/, "")
result = hal.split(/,/).map do |v|
v... |
github | mattetti/merb_babel | https://github.com/mattetti/merb_babel | lib/merb_babel/m_i18n.rb | Ruby | mit | 19 | master | 1,166 | module MI18n
def self.lookup(options)
keys = [options[:keys].map{|key| key.to_s}].flatten
language = options[:language]
country = options[:country]
raise ArgumentError, "You need to pass a language reference" unless language
raise ArgumentError, "You need to pass a localization key" if keys.em... |
github | mattetti/merb_babel | https://github.com/mattetti/merb_babel | lib/merb_babel/m_l10n.rb | Ruby | mit | 19 | master | 4,653 | module ML10n
LANGUAGE_CODE_KEY = 'mloc_language_code'.freeze
COUNTRY_CODE_KEY = 'mloc_country_code'.freeze
class << self
# TODO add a mutex for when we load the localizations, in case people want to load the localizations
# at runtime
# all localizations are saved in this class variable
# l... |
github | mattetti/merb_babel | https://github.com/mattetti/merb_babel | lib/merb_babel/locale_detector.rb | Ruby | mit | 19 | master | 2,216 | module LocaleDetector
LANGUAGE_TO_COUNTRY = {
"nn"=>["NO"],
"uk"=>["UA"],
"it"=>["IT", "GI", "CH", "LY", "SM"],
"zh_TW"=>["TT", "VN", "HK"],
"no"=>["NO"],
"st"=>["ZA"],
"tk"=>["TM"],
"bn"=>["IN"],
"mn"=>["MN"],
"ja"=>["JP"],
"fr"=>["FR", "CD", "GG", "RW", "CG", "LU", "TT", ... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | Gemfile | Ruby | mit | 19 | develop | 538 | source "https://rubygems.org"
# Declare your gem's dependencies in active_sierra.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# Declare any dependencies that are still in development here instead o... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | active_sierra.gemspec | Ruby | mit | 19 | develop | 751 | $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "active_sierra/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "active_sierra"
s.version = ActiveSierra::VERSION
s.authors = ["James Van Mil, Sean Crowe"]
s.emai... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | Rakefile | Ruby | mit | 19 | develop | 677 | begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
require 'rdoc/task'
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'ActiveSierra'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | test/dummy/config/application.rb | Ruby | mit | 19 | develop | 887 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)
require "active_sierra"
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in con... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | test/dummy/config/initializers/secret_token.rb | Ruby | mit | 19 | develop | 659 | # Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to diction... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/resource_view.rb | Ruby | mit | 19 | develop | 245 | class ResourceView < SierraTable
has_many :varfield_views, foreign_key: 'record_id'
has_one :resource_record, foreign_key: 'id'
has_one :record_metadata, foreign_key: 'id'
self.table_name = 'resource_view'
self.primary_key = 'id'
end |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/varfield_view.rb | Ruby | mit | 19 | develop | 934 | class VarfieldView < SierraTable
has_one :item_view
has_many :subfields, foreign_key: 'varfield_id'
scope :field_content, ->(content) { where("field_content SIMILAR TO ?", content) }
scope :marc_tag, ->(marc_tag) { where("marc_tag = ?", marc_tag) }
scope :marc_ind1, ->(marc_ind1) { where("marc_ind1 = ?", mar... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/item_view.rb | Ruby | mit | 19 | develop | 537 | class ItemView < SierraTable
has_many :varfield_views, foreign_key: 'record_id'
has_one :item_record, foreign_key: 'id'
has_many :bib_records, through: :item_record
has_many :bib_views, through: :bib_records
has_many :order_records, through: :bib_records
has_many :order_views, through: :order_records
has_... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/bib_view.rb | Ruby | mit | 19 | develop | 421 | class BibView < SierraTable
has_many :varfield_views, foreign_key: 'record_id'
has_one :bib_record, foreign_key: 'id'
has_many :item_records, through: :bib_record
has_many :item_views, through: :item_records
has_many :order_records, through: :bib_record
has_many :order_views, through: :order_records
has_o... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/holding_record_cardlink.rb | Ruby | mit | 19 | develop | 380 | class HoldingRecordCardlink < SierraTable
belongs_to :holding_record_card, foreign_key: 'holding_record_card_id'
has_one :holding_record, through: :holding_record_card
has_one :holding_view, through: :holding_record_card
has_many :holding_record_boxes, foreign_key: 'holding_record_cardlink_id'
self.table_na... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/bib_record_item_record_link.rb | Ruby | mit | 19 | develop | 212 | class BibRecordItemRecordLink < SierraTable
belongs_to :item_record, foreign_key: 'item_record_id'
belongs_to :bib_record, foreign_key: 'bib_record_id'
self.table_name = 'bib_record_item_record_link'
end |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/holding_view.rb | Ruby | mit | 19 | develop | 437 | class HoldingView < SierraTable
has_one :holding_record, foreign_key: 'id'
has_many :bib_views, through: :holding_record
has_many :bib_records, through: :holding_record
has_many :varfield_views, foreign_key: 'record_id'
has_one :record_metadata, foreign_key: 'id'
def bib_record
self.bib_records.first
... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/order_view.rb | Ruby | mit | 19 | develop | 695 | class OrderView < SierraTable
has_many :varfield_views, foreign_key: 'record_id'
has_one :order_record, foreign_key: 'id'
has_one :bib_record, through: :order_record
has_one :bib_view, through: :bib_record
has_many :item_records, through: :bib_record
has_many :item_views, through: :item_records
has_... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/bib_record_holding_record_link.rb | Ruby | mit | 19 | develop | 224 | class BibRecordHoldingRecordLink < SierraTable
belongs_to :holding_record, foreign_key: 'holding_record_id'
belongs_to :bib_record, foreign_key: 'bib_record_id'
self.table_name = 'bib_record_holding_record_link'
end |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/holding_record_card.rb | Ruby | mit | 19 | develop | 309 | class HoldingRecordCard < SierraTable
belongs_to :holding_record, foreign_key: 'holding_record_id'
belongs_to :holding_view, foreign_key: 'holding_record_id'
has_one :holding_record_cardlink, foreign_key: 'holding_record_card_id'
self.primary_key = 'id'
self.table_name = 'holding_record_card'
end |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/resource_record.rb | Ruby | mit | 19 | develop | 254 | class ResourceRecord < SierraTable
has_one :resource_view, foreign_key: 'id'
has_many :varfield_views, foreign_key: 'record_id'
has_one :record_metadata, foreign_key: 'id'
self.table_name = 'resource_record'
self.primary_key = 'record_id'
end |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/holding_record.rb | Ruby | mit | 19 | develop | 519 | class HoldingRecord < SierraTable
has_many :bib_record_holding_record_links
has_many :bib_records, through: :bib_record_holding_record_links
has_many :bib_views, through: :bib_records
has_one :holding_record_card, foreign_key: 'holding_record_id'
has_many :varfield_views, foreign_key: 'record_id'
has_one ... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/holding_record_box.rb | Ruby | mit | 19 | develop | 369 | class HoldingRecordBox < SierraTable
belongs_to :holding_record_cardlink, foreign_key: 'holding_record_cardlink_id'
has_one :holding_record_card, through: :holding_record_cardlink
has_one :holding_record, through: :holding_record_card
has_one :holding_view, through: :holding_record_card
self.primary_key = ... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/item_record.rb | Ruby | mit | 19 | develop | 603 | class ItemRecord < SierraTable
has_one :item_view, foreign_key: 'id'
has_many :bib_record_item_record_links
has_many :bib_records, through: :bib_record_item_record_links
has_many :bib_views, through: :bib_records
has_many :varfield_views, foreign_key: :record_id
has_many :order_records, through: :bib_record... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/subfield.rb | Ruby | mit | 19 | develop | 681 | class Subfield < SierraTable
scope :content, ->(content) { where("content SIMILAR TO ?", content) }
scope :marc_tag, ->(marc_tag) { where("marc_tag = ?", marc_tag) }
scope :marc_ind1, ->(marc_ind1) { where("marc_ind1 = ?", marc_ind1) }
scope :marc_ind2, ->(marc_ind2) { where("marc_ind2 = ?", marc_ind2) }
scop... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/order_record.rb | Ruby | mit | 19 | develop | 678 | class OrderRecord < SierraTable
has_one :order_view, foreign_key: 'id'
has_one :bib_record_order_record_link
has_one :bib_record, through: :bib_record_order_record_link
has_one :bib_view, through: :bib_record
has_many :item_records, through: :bib_record
has_many :item_views, through: :item_records
has_man... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/order_record_cmf.rb | Ruby | mit | 19 | develop | 355 | class OrderRecordCmf < SierraTable
## Key to fund_master table is stored as a string here,
# and an integer at the destination,
# so we're gathering these with this function
def fund
(FundMaster.where("code_num = ?", self.fund_code.to_i).collect {|o| o.code}).last
end
self.table_name = 'order_record... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/bib_record.rb | Ruby | mit | 19 | develop | 550 | class BibRecord < SierraTable
has_one :bib_view, foreign_key: 'id'
has_many :bib_record_item_record_links
has_many :item_records, through: :bib_record_item_record_links
has_many :item_views, through: :item_records
has_many :bib_record_order_record_links
has_many :order_records, through: :bib_record_order_re... |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/bib_record_order_record_link.rb | Ruby | mit | 19 | develop | 216 | class BibRecordOrderRecordLink < SierraTable
belongs_to :order_record, foreign_key: 'order_record_id'
belongs_to :bib_record, foreign_key: 'bib_record_id'
self.table_name = 'bib_record_order_record_link'
end |
github | uclibs/active_sierra | https://github.com/uclibs/active_sierra | app/models/subfield_view.rb | Ruby | mit | 19 | develop | 769 | class SubfieldView < SierraTable
scope :content, ->(content) { where("content SIMILAR TO ?", content) }
scope :marc_tag, ->(marc_tag) { where("marc_tag = ?", marc_tag) }
scope :marc_ind1, ->(marc_ind1) { where("marc_ind1 = ?", marc_ind1) }
scope :marc_ind2, ->(marc_ind2) { where("marc_ind2 = ?", marc_ind2) }
... |
github | fargelus/space-invaders | https://github.com/fargelus/space-invaders | space_invaders.gemspec | Ruby | mit | 19 | master | 1,500 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require_relative 'lib/space_invaders/version'
Gem::Specification.new do |spec|
spec.name = 'space_invaders'
spec.version = SpaceInvaders::VERSION
spec.authors = ['far... |
github | fargelus/space-invaders | https://github.com/fargelus/space-invaders | spec/spec_helper.rb | Ruby | mit | 19 | master | 401 | # frozen_string_literal: true
require 'bundler/setup'
require 'space_invaders'
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_monke... |
github | fargelus/space-invaders | https://github.com/fargelus/space-invaders | spec/space_invaders_spec.rb | Ruby | mit | 19 | master | 222 | # frozen_string_literal: true
RSpec.describe SpaceInvaders do
it 'has a version number' do
expect(SpaceInvaders::VERSION).not_to be nil
end
it 'does something useful' do
expect(false).to eq(true)
end
end |
github | fargelus/space-invaders | https://github.com/fargelus/space-invaders | lib/space_invaders/aliens.rb | Ruby | mit | 19 | master | 3,844 | # frozen_string_literal: true
require 'gosu'
require 'forwardable'
require_relative 'base/settings'
require_relative 'base/helpers'
require_relative 'base/timer'
require_relative 'game_objects/image_objects/animated_alien'
require_relative 'game_objects/image_objects/mistery_alien'
module SpaceInvaders
class Aliens... |
github | fargelus/space-invaders | https://github.com/fargelus/space-invaders | lib/space_invaders/game.rb | Ruby | mit | 19 | master | 1,200 | # frozen_string_literal: true
require_relative 'scenes/main_scene'
require_relative 'scenes/game_over_scene'
require_relative 'scenes/menu_scene'
module SpaceInvaders
class Game < Gosu::Window
def initialize(width = Settings::WIDTH, height = Settings::HEIGHT)
super
self.caption = Settings::CAPTION
... |
github | fargelus/space-invaders | https://github.com/fargelus/space-invaders | lib/space_invaders/output/printable_text.rb | Ruby | mit | 19 | master | 861 | # frozen_string_literal: true
require 'gosu'
require_relative '../base/settings'
module SpaceInvaders
class PrintableText
DELAY_DRAW_MSEC = 70
def initialize(options)
@full_text = options[:text].upcase
@chars_to_draw = 1
@x = options[:x]
@y = options[:y]
@color = options[:colo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.