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 | jonathanhefner/garden_variety | https://github.com/jonathanhefner/garden_variety | test/dummy/config/environments/development.rb | Ruby | mit | 18 | master | 1,620 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... |
github | jonathanhefner/garden_variety | https://github.com/jonathanhefner/garden_variety | test/dummy/app/policies/application_policy.rb | Ruby | mit | 18 | master | 612 | class ApplicationPolicy
attr_reader :user, :record
def initialize(user, record)
@user = user
@record = record
end
def index?
false
end
def show?
scope.where(:id => record.id).exists?
end
def create?
false
end
def new?
create?
end
def update?
false
end
def e... |
github | jonathanhefner/garden_variety | https://github.com/jonathanhefner/garden_variety | lib/garden_variety.rb | Ruby | mit | 18 | master | 309 | require "pundit"
require "garden_variety/version"
require "garden_variety/actions"
require "garden_variety/controller"
require "garden_variety/current_user_stub"
begin
require "talent_scout"
rescue LoadError
# do nothing
else
require "garden_variety/talent_scout"
end
require "garden_variety/railtie" |
github | jonathanhefner/garden_variety | https://github.com/jonathanhefner/garden_variety | lib/garden_variety/controller.rb | Ruby | mit | 18 | master | 10,317 | module GardenVariety
module Controller
extend ActiveSupport::Concern
include Pundit
module ClassMethods
# Macro to include garden variety implementations of specified
# actions in the controller. If no actions are specified, all
# typical REST actions (index, show, new, create, edit, ... |
github | jonathanhefner/garden_variety | https://github.com/jonathanhefner/garden_variety | lib/garden_variety/actions.rb | Ruby | mit | 18 | master | 3,004 | module GardenVariety
REDIRECT_CODES = [301, 302, 303, 307, 308].to_set
module IndexAction
# Garden variety controller +index+ action.
# @return [void]
def index
authorize(self.class.model_class)
self.collection = policy_scope(find_collection)
end
end
module ShowAction
# Garden... |
github | jonathanhefner/garden_variety | https://github.com/jonathanhefner/garden_variety | lib/garden_variety/railtie.rb | Ruby | mit | 18 | master | 793 | module GardenVariety
# @!visibility private
class Railtie < ::Rails::Railtie
# Render 404 on Pundit::NotAuthorizedError in production. (Helpful
# error pages will still be shown in development.) Code 404 is used
# because it is more discreet than 403, because it is explicitly
# allowed by RFC7231 ... |
github | jonathanhefner/garden_variety | https://github.com/jonathanhefner/garden_variety | lib/garden_variety/talent_scout.rb | Ruby | mit | 18 | master | 612 | module GardenVariety
# @!visibility private
module TalentScout
module ModelSearchClassOverride
def model_search_class
@model_search_class ||= "#{model_class}Search".constantize
end
end
::TalentScout::Controller::ClassMethods.prepend(ModelSearchClassOverride)
module FindCollect... |
github | jonathanhefner/garden_variety | https://github.com/jonathanhefner/garden_variety | lib/generators/garden/optimized_generate_action.rb | Ruby | mit | 18 | master | 273 | # @!visibility private
module Garden
module OptimizedGenerateAction
def generate(what, *args)
log :generate, what
in_root do
silence_warnings do
::Rails::Command.invoke("generate", [what, *args])
end
end
end
end
end |
github | jonathanhefner/garden_variety | https://github.com/jonathanhefner/garden_variety | lib/generators/garden/install/install_generator.rb | Ruby | mit | 18 | master | 433 | require "generators/garden/optimized_generate_action"
# @!visibility private
module Garden
module Generators
class InstallGenerator < Rails::Generators::Base
include OptimizedGenerateAction
source_root File.join(__dir__, "templates")
def copy_locales
directory "locales", "config/local... |
github | jonathanhefner/garden_variety | https://github.com/jonathanhefner/garden_variety | lib/generators/garden/scaffold/scaffold_generator.rb | Ruby | mit | 18 | master | 1,775 | require "generators/garden/optimized_generate_action"
# @!visibility private
module Garden
module Generators
class ScaffoldGenerator < Rails::Generators::Base
include OptimizedGenerateAction
source_root File.join(__dir__, "templates")
argument :resource, type: :string
# NOTE: an approp... |
github | joshdavenport/jekyll-regex-replace | https://github.com/joshdavenport/jekyll-regex-replace | jekyll-regex-replace.gemspec | Ruby | mit | 18 | master | 600 | Gem::Specification.new do |spec|
spec.name = "jekyll-regex-replace"
spec.version = '1.1.0'
spec.authors = ["Josh Davenport"]
spec.email = ["josh@joshdavenport.co.uk"]
spec.summary = 'Simple module to allow using regular expression replacing via liquid filters'
spec.homepag... |
github | joshdavenport/jekyll-regex-replace | https://github.com/joshdavenport/jekyll-regex-replace | lib/jekyll-regex-replace.rb | Ruby | mit | 18 | master | 405 | require 'liquid'
module Jekyll
module RegexReplace
def regex_replace(str, regex_search, value_replace)
regex = /#{regex_search}/
return str.gsub(regex, value_replace)
end
def regex_replace_once(str, regex_search, value_replace)
regex = /#{regex_search}/
return str.sub(regex, valu... |
github | IamLucif3r/Buffer-Overflow | https://github.com/IamLucif3r/Buffer-Overflow | pattern_create.rb | Ruby | mit | 18 | main | 2,345 | begin
msfbase = __FILE__
while File.symlink?(msfbase)
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
end
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', '..', 'lib')))
$LOAD_PATH.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
... |
github | IamLucif3r/Buffer-Overflow | https://github.com/IamLucif3r/Buffer-Overflow | pattern_offset.rb | Ruby | mit | 18 | main | 4,848 | begin
msfbase = __FILE__
while File.symlink?(msfbase)
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
end
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', '..', 'lib')))
$LOAD_PATH.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
... |
github | nebulab/umarell | https://github.com/nebulab/umarell | umarell.gemspec | Ruby | mit | 18 | master | 1,412 | # frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path('lib', __dir__)
require 'umarell/version'
Gem::Specification.new do |s|
s.name = 'umarell'
s.version = Umarell::Version::STRING
s.platform = Gem::Platform::RUBY
s.required_ruby_version = '>= 2.5.0'
s.authors = ['Filippo Liverani']
s.descrip... |
github | nebulab/umarell | https://github.com/nebulab/umarell | spec/spec_helper.rb | Ruby | mit | 18 | master | 378 | # frozen_string_literal: true
require 'umarell'
require 'rspec'
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.sha... |
github | nebulab/umarell | https://github.com/nebulab/umarell | spec/umarell/cli_spec.rb | Ruby | mit | 18 | master | 1,000 | # frozen_string_literal: true
describe Umarell::CLI do
it 'calls commands with arguments' do
arguments = instance_spy(Umarell::Arguments, target: 'a_target')
command = instance_spy(Umarell::Command)
tools = { 'a_command' => ['-opt'] }
cli = described_class.new(tools, arguments)
allow(Umarell::Com... |
github | nebulab/umarell | https://github.com/nebulab/umarell | spec/umarell/arguments_spec.rb | Ruby | mit | 18 | master | 1,164 | # frozen_string_literal: true
describe Umarell::Arguments do
subject(:arguments) { described_class.new }
before do
allow(arguments).to receive(:exit)
end
it 'uses default target if not present' do
ARGV.replace([])
arguments.parse
expect(arguments.target).to eq('./')
expect(arguments).no... |
github | nebulab/umarell | https://github.com/nebulab/umarell | spec/umarell/command_spec.rb | Ruby | mit | 18 | master | 936 | # frozen_string_literal: true
describe Umarell::Command do
it 'creates a full command' do
command = described_class.new('a_command', ['-opt', 'a_target'])
allow(command).to receive(:system)
command.run
expect(command).to have_received(:system)
.with(/a_command -opt a_target/)
end
it 'add... |
github | nebulab/umarell | https://github.com/nebulab/umarell | lib/umarell/arguments.rb | Ruby | mit | 18 | master | 1,611 | # frozen_string_literal: true
require 'optparse'
module Umarell
# The class responsible of parsing command line arguments
class Arguments
attr_reader :autofix, :target
alias autofix? autofix
DEFAULT_TARGET = './'
MODIFIED_FILES_TARGET = '`git ls-files -mo --exclude-standard %s`'
def initial... |
github | nebulab/umarell | https://github.com/nebulab/umarell | lib/umarell/cli.rb | Ruby | mit | 18 | master | 1,241 | # frozen_string_literal: true
require_relative 'arguments'
require_relative 'command'
module Umarell
TOOLS = {
'bundler-audit' => ['check', '--update'],
'brakeman' => ['-w2', '-q', '--no-pager', '--no-summary'],
'rubocop' => [],
'erblint' => [],
'reek' => [],
'rails_best_practices': [],
... |
github | nebulab/umarell | https://github.com/nebulab/umarell | lib/umarell/command.rb | Ruby | mit | 18 | master | 626 | # frozen_string_literal: true
module Umarell
# The class responsible for running commands
class Command
def initialize(name, arguments = [])
@name = name
@arguments = arguments
end
# Run the command
def run
system "echo '#{header}'; #{self}; echo '#{footer}'"
end
def to_... |
github | postmodern/uri-query_params | https://github.com/postmodern/uri-query_params | Gemfile | Ruby | mit | 18 | main | 331 | source 'https://rubygems.org'
gemspec
group :test do
gem 'addressable'
end
group :development do
gem 'rake'
gem 'rubygems-tasks', '~> 0.2'
gem 'rspec', '~> 3.0'
gem 'simplecov', '~> 0.20'
gem 'kramdown'
gem 'redcarpet', platform: :mri
gem 'yard', '~> 0.9'
gem 'yard-spellcheck', require:... |
github | postmodern/uri-query_params | https://github.com/postmodern/uri-query_params | Rakefile | Ruby | mit | 18 | main | 204 | require 'rubygems'
require 'rubygems/tasks'
Gem::Tasks.new
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new
task :test => :spec
task :default => :spec
require 'yard'
YARD::Rake::YardocTask.new |
github | postmodern/uri-query_params | https://github.com/postmodern/uri-query_params | uri-query_params.gemspec | Ruby | mit | 18 | main | 1,971 | # encoding: utf-8
require 'yaml'
Gem::Specification.new do |gem|
gemspec = YAML.load_file('gemspec.yml')
gem.name = gemspec.fetch('name')
gem.version = gemspec.fetch('version') do
require_relative 'lib/uri/query_params/version'
URI::QueryParams::VERSION
en... |
github | postmodern/uri-query_params | https://github.com/postmodern/uri-query_params | lib/uri/query_params/query_params.rb | Ruby | mit | 18 | main | 2,938 | # frozen_string_literal: true
require 'uri/common'
module URI
module QueryParams
# RFC 3986 unsafe characters (including ' ')
UNSAFE = [
'!', '*', "'", '(', ')', ';', ':', '@', '&', '=', '+', '$', ',',
'/', '?', '%', '#', '[', ']', ' ', "\f", "\n", "\r", "\t", "\v",
"\x7f", *("\x00".."\x1f... |
github | postmodern/uri-query_params | https://github.com/postmodern/uri-query_params | lib/uri/query_params/mixin.rb | Ruby | mit | 18 | main | 3,168 | # frozen_string_literal: true
require_relative 'query_params'
module URI
module QueryParams
#
# Adds the ability to parse individual parameters from a the query field
# of a URI.
#
module Mixin
# Allows setting the query_params.
attr_writer :query_params
#
# Called when ... |
github | postmodern/uri-query_params | https://github.com/postmodern/uri-query_params | lib/uri/query_params/core_ext/uri/generic.rb | Ruby | mit | 18 | main | 1,214 | # frozen_string_literal: true
require_relative '../../mixin'
require 'uri/generic'
module URI
class Generic
include URI::QueryParams::Mixin
#
# Constructs String from URI
#
# @note
# This is the `URI::Generic#to_s` method from Ruby 3.0.0, with the minor
# modification of calling t... |
github | postmodern/uri-query_params | https://github.com/postmodern/uri-query_params | lib/uri/query_params/core_ext/uri/http.rb | Ruby | mit | 18 | main | 831 | # frozen_string_literal: true
require_relative 'generic'
require 'uri/http'
module URI
class HTTP < Generic
alias raw_request_uri request_uri
#
# Returns the full path for an HTTP request.
#
# @return [String, nil]
# The request URI (path + query params) or `nil` if the URI has no
#... |
github | postmodern/uri-query_params | https://github.com/postmodern/uri-query_params | spec/query_params_mixin_examples.rb | Ruby | mit | 18 | main | 2,069 | require 'spec_helper'
require 'uri/query_params'
require 'uri'
shared_examples_for "URI::QueryParams::Mixin" do
let(:query) { 'x=1&y=one%20two&z' }
before { subject.query = query }
context "when included" do
it "should include QueryParams::Mixin" do
expect(subject.class).to include(URI::QueryParams:... |
github | postmodern/uri-query_params | https://github.com/postmodern/uri-query_params | spec/query_params_spec.rb | Ruby | mit | 18 | main | 2,578 | require 'spec_helper'
require 'uri/query_params'
require 'uri'
describe URI::QueryParams do
describe "parse" do
it "should not parse an empty String" do
expect(subject.parse('')).to be_empty
end
it "should not parse empty params" do
expect(subject.parse('a&&&b')).to eq({'a' => '', 'b' => ''... |
github | postmodern/uri-query_params | https://github.com/postmodern/uri-query_params | spec/extensions_spec.rb | Ruby | mit | 18 | main | 333 | require 'spec_helper'
require 'uri/query_params/extensions'
describe 'uri/query_params/extensions' do
let(:root) { File.expand_path('..',__dir__) }
let(:path) { File.join(root,'lib','uri','query_params','core_ext.rb') }
it "must require 'uri/query_params/core_ext'" do
expect($LOADED_FEATURES).to include(pat... |
github | postmodern/uri-query_params | https://github.com/postmodern/uri-query_params | spec/extensions/uri_spec.rb | Ruby | mit | 18 | main | 368 | require 'spec_helper'
require 'uri/query_params/extensions/uri'
describe 'uri/query_params/extensions/uri' do
let(:root) { File.expand_path(File.join('..','..'),__dir__) }
let(:path) { File.join(root,'lib','uri','query_params','core_ext', 'uri.rb') }
it "must require 'uri/query_params/core_ext/uri'" do
expe... |
github | postmodern/uri-query_params | https://github.com/postmodern/uri-query_params | spec/extensions/uri/generic_spec.rb | Ruby | mit | 18 | main | 416 | require 'spec_helper'
require 'uri/query_params/extensions/uri/generic'
describe 'uri/query_params/extensions/uri/generic' do
let(:root) { File.expand_path(File.join('..','..','..'),__dir__) }
let(:path) do
File.join(root,'lib','uri','query_params','core_ext', 'uri','generic.rb')
end
it "must require 'uri... |
github | postmodern/uri-query_params | https://github.com/postmodern/uri-query_params | spec/extensions/addressable/uri.rb | Ruby | mit | 18 | main | 432 | require 'spec_helper'
require 'uri/query_params/extensions/addressable/uri'
describe 'uri/query_params/extensions/addressable/uri' do
let(:root) { File.expand_path(File.join('..','..','..'),__dir__) }
let(:path) do
File.join(root,'lib','uri','query_params','core_ext', 'addressable','uri.rb')
end
it "must ... |
github | postmodern/uri-query_params | https://github.com/postmodern/uri-query_params | spec/core_ext/addressable/uri_spec.rb | Ruby | mit | 18 | main | 268 | require 'spec_helper'
require 'query_params_mixin_examples'
require 'uri/query_params/core_ext/addressable/uri'
describe Addressable::URI do
subject { described_class.parse('http://www.example.com/page.php') }
it_should_behave_like "URI::QueryParams::Mixin"
end |
github | postmodern/uri-query_params | https://github.com/postmodern/uri-query_params | spec/core_ext/uri/generic_spec.rb | Ruby | mit | 18 | main | 218 | require 'spec_helper'
require 'query_params_mixin_examples'
require 'uri/query_params/core_ext/uri'
describe URI::Generic do
subject { URI.parse('/page.php') }
it_should_behave_like "URI::QueryParams::Mixin"
end |
github | postmodern/uri-query_params | https://github.com/postmodern/uri-query_params | spec/core_ext/uri/http_spec.rb | Ruby | mit | 18 | main | 2,216 | require 'spec_helper'
require 'query_params_mixin_examples'
require 'uri/query_params/core_ext/uri/http'
describe URI::HTTP do
subject { URI.parse("http://www.example.com/page.php") }
it_should_behave_like "URI::QueryParams::Mixin"
describe "#request_uri" do
context "when #query_params is set" do
let... |
github | 14113/fio_api | https://github.com/14113/fio_api | fio_api.gemspec | Ruby | mit | 18 | master | 4,123 | # Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
# stub: fio_api 0.0.7 ruby lib
Gem::Specification.new do |s|
s.name = "fio_api".freeze
s.version = "0.0.11"
s.required_rubygems_version = Gem::Requirement.new(">= ... |
github | 14113/fio_api | https://github.com/14113/fio_api | Gemfile | Ruby | mit | 18 | master | 272 | # frozen_string_literal: true
source 'http://rubygems.org'
gem 'httparty', '>= 0.16.2'
group :development do
gem 'bundler', '>= 1.10.6'
gem 'jeweler', '>= 2.1.1'
gem 'rdoc', '>= 4.2.0'
gem 'rspec'
gem 'rspec-mocks', '>= 3.4.0'
gem 'vcr'
gem 'webmock'
end |
github | 14113/fio_api | https://github.com/14113/fio_api | Rakefile | Ruby | mit | 18 | master | 1,250 | require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
warn e.message
warn 'Run `bundle install` to install missing gems'
exit e.status_code
end
require 'rake'
require 'jeweler'
Jeweler::Tasks.new do |gem|
# gem is a Gem::Specification... see http:/... |
github | 14113/fio_api | https://github.com/14113/fio_api | lib/fio_api.rb | Ruby | mit | 18 | master | 921 | require 'utils/hash'
require 'tempfile'
require 'base'
require 'base/account'
require 'base/transaction'
require 'base/list'
require 'base/request'
require 'base/payment'
require 'base/payments/status'
require 'base/payments/domestic'
require 'base/payments/xml/root'
require 'base/payments/xml/item'
require 'base/deser... |
github | 14113/fio_api | https://github.com/14113/fio_api | lib/base.rb | Ruby | mit | 18 | master | 405 | module FioAPI
class Base
# Allow ruby object to be initialized with params
#
# == Parameters:
# hash::
# Hash where key is attribute and value is new attribute value
#
# == Returns:
# New object with prefilled attributes
#
def initialize(*hash)
hash.first.each { |k, v... |
github | 14113/fio_api | https://github.com/14113/fio_api | lib/base/request.rb | Ruby | mit | 18 | master | 321 | require 'httparty'
module FioAPI
class Request < FioAPI::Base
include HTTParty
base_uri 'https://fioapi.fio.cz/v1/rest/'
class << self
# Reader for token
def token
@@token
end
# Setter for token
def token=(token)
@@token = token
end
end
end
end |
github | 14113/fio_api | https://github.com/14113/fio_api | lib/base/list.rb | Ruby | mit | 18 | master | 2,914 | module FioAPI
# Base class for request to transactions listing and account information
class List < FioAPI::Base
attr_accessor :request, :response
# Allow request transactions in date range
#
# == Parameters:
# from_date::
# Start date for transactions list
# to_date::
# End dat... |
github | 14113/fio_api | https://github.com/14113/fio_api | lib/base/payment.rb | Ruby | mit | 18 | master | 934 | module FioAPI
# Base class for submit payments and waiting for authorization
class Payment
attr_accessor :request, :response, :payments
def initialize(payments)
@payments = [payments].flatten
end
def path
"/import/?token=#{FioAPI.token}&type=xml"
end
def import
self.requ... |
github | 14113/fio_api | https://github.com/14113/fio_api | lib/base/account.rb | Ruby | mit | 18 | master | 309 | module FioAPI
# == Account class representing the Account entity
class Account < FioAPI::Base
attr_accessor :account_id, :bank_id, :currency, :iban, :bic, :opening_balance, :closing_balance,
:date_start, :date_end, :year_list, :id_list, :id_from, :id_to, :id_last_download
end
end |
github | 14113/fio_api | https://github.com/14113/fio_api | lib/base/transaction.rb | Ruby | mit | 18 | master | 397 | module FioAPI
# == Transaction class representing the Transaction entity
class Transaction < FioAPI::Base
attr_accessor :transaction_id, :date, :amount, :currency, :account, :account_name, :bank_code,
:bank_name, :ks, :vs, :ss, :user_identification, :message_for_recipient, :transaction_type,
... |
github | 14113/fio_api | https://github.com/14113/fio_api | lib/base/deserializers/import_response_deserializer.rb | Ruby | mit | 18 | master | 1,413 | require 'httparty'
module FioAPI
# == ImportResponseDeserializer
# Deserializer responsible for response json deserializing. Should construct object with status attributes.
#
class ImportResponseDeserializer < HTTParty::Parser
attr_accessor :status
# Parse json
#
# == Returns:
# Should r... |
github | 14113/fio_api | https://github.com/14113/fio_api | lib/base/deserializers/list_response_deserializer.rb | Ruby | mit | 18 | master | 3,852 | require 'httparty'
module FioAPI
# == ListResponseDeserializer
# Deserializer responsible for response json deserializing. Should construct object with account and transactions attributes.
#
class ListResponseDeserializer < HTTParty::Parser
attr_accessor :account, :transactions
# Parse json
#
... |
github | 14113/fio_api | https://github.com/14113/fio_api | lib/base/payments/status.rb | Ruby | mit | 18 | master | 225 | module FioAPI
module Payments
# == Status class representing the Status entity
class Status < FioAPI::Base
attr_accessor :error_code, :id_instruction, :error_message, :sum_credit, :sum_debet
end
end
end |
github | 14113/fio_api | https://github.com/14113/fio_api | lib/base/payments/domestic.rb | Ruby | mit | 18 | master | 347 | module FioAPI
module Payments
# == Domestic class representing the Domestic entity
class Domestic < FioAPI::Base
attr_accessor :account_from, :currency, :amount, :account_to, :bank_code, :ks, :vs, :ss,
:date, :message_for_recipient, :comment
def payment_type
'431001'
... |
github | 14113/fio_api | https://github.com/14113/fio_api | lib/base/payments/xml/root.rb | Ruby | mit | 18 | master | 760 | module FioAPI
module Payments
module Xml
class Root
XSI_OPTIONS = {
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:noNamespaceSchemaLocation' => 'http://www.fio.cz/schema/importIB.xsd'
}.freeze
attr_reader :payments
def initialize(payme... |
github | 14113/fio_api | https://github.com/14113/fio_api | lib/base/payments/xml/item.rb | Ruby | mit | 18 | master | 1,096 | module FioAPI
module Payments
module Xml
class Item
attr_reader :builder, :payment
def initialize(builder, payment)
@builder = builder
@payment = payment
end
def build
@build ||= builder.DomesticTransaction do
builder.accountFrom pa... |
github | 14113/fio_api | https://github.com/14113/fio_api | lib/utils/hash.rb | Ruby | mit | 18 | master | 363 | class Hash
# Try provided path on hash
#
# == Parameters:
# args::
# Keys of hash you want to try
#
# == Returns:
# Value or nil if key does not exist
#
def try_path(*args)
value = self
args.each { |arg_name| value = value.nil? ? nil : value[arg_name] }
value
end
end
class NilClas... |
github | 14113/fio_api | https://github.com/14113/fio_api | spec/spec_helper.rb | Ruby | mit | 18 | master | 523 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'fio_api'
require 'vcr'
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {... |
github | 14113/fio_api | https://github.com/14113/fio_api | spec/fio_api_spec.rb | Ruby | mit | 18 | master | 354 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe FioAPI do
it 'should setup token' do
token = 'some token'
FioAPI.token = token
expect(FioAPI::Request.token).to eq token
end
it 'should return token' do
token = 'some token'
FioAPI::Request.token = token
expect(Fi... |
github | 14113/fio_api | https://github.com/14113/fio_api | spec/base/account_spec.rb | Ruby | mit | 18 | master | 392 | require_relative '../spec_helper'
describe FioAPI::Account do
describe 'instance attributes' do
%i[account_id bank_id currency iban bic opening_balance closing_balance
date_start date_end year_list id_list id_from id_to id_last_download].each do |attr|
it "should respond to #{attr}" do
expe... |
github | 14113/fio_api | https://github.com/14113/fio_api | spec/base/list_spec.rb | Ruby | mit | 18 | master | 2,044 | require_relative '../spec_helper'
describe FioAPI::List do
before(:each) do
@list = FioAPI::List.new
end
it 'should set request with uri for date range' do
date_from = Date.new(2011, 1, 1)
date_to = Date.new(2012, 11, 25)
url = "https://fioapi.fio.cz/v1/rest/periods/#{FioAPI.token}/#{date_from}/... |
github | 14113/fio_api | https://github.com/14113/fio_api | spec/base/transaction_spec.rb | Ruby | mit | 18 | master | 455 | require_relative '../spec_helper'
describe FioAPI::Transaction do
describe 'instance attributes' do
%i[transaction_id date amount currency account account_name bank_code
bank_name ks vs ss user_identification message_for_recipient transaction_type
sender detail_info comment bic action_id].each do |... |
github | 14113/fio_api | https://github.com/14113/fio_api | spec/base/payment_spec.rb | Ruby | mit | 18 | master | 2,468 | require_relative '../spec_helper'
describe FioAPI::Payment do
let(:date) { '2018-06-15' }
let(:amount) { 100.0 }
before(:each) do
@payment = FioAPI::Payments::Domestic.new(account_from: '11111111', currency: 'CZK', amount: amount, account_to: '22222222', bank_code: '3030', date: date)
@service = FioAPI::... |
github | 14113/fio_api | https://github.com/14113/fio_api | spec/base/payments/status_spec.rb | Ruby | mit | 18 | master | 340 | require_relative '../../spec_helper'
describe FioAPI::Payments::Status do
describe 'instance attributes' do
%i[
error_code id_instruction error_message sum_credit sum_debet
].each do |attr|
it "should respond to #{attr}" do
expect(FioAPI::Payments::Status.new).to respond_to(attr)
en... |
github | 14113/fio_api | https://github.com/14113/fio_api | spec/base/payments/domestic_spec.rb | Ruby | mit | 18 | master | 383 | require_relative '../../spec_helper'
describe FioAPI::Payments::Domestic do
describe 'instance attributes' do
%i[
account_from currency amount account_to bank_code ks vs ss
date message_for_recipient comment
].each do |attr|
it "should respond to #{attr}" do
expect(FioAPI::Payments:... |
github | 14113/fio_api | https://github.com/14113/fio_api | spec/base/payments/xml/root_spec.rb | Ruby | mit | 18 | master | 1,747 | require_relative '../../../spec_helper'
describe FioAPI::Payments::Xml::Root do
let(:payments) { [] }
let(:service) { FioAPI::Payments::Xml::Root.new(payments) }
context 'build xml without payments' do
it 'returns empty xml' do
expect(service.build).to eq <<-XML
<?xml version="1.0" encoding="UTF-8"?>
... |
github | 14113/fio_api | https://github.com/14113/fio_api | spec/base/deserializers/list_response_deserializer_spec.rb | Ruby | mit | 18 | master | 4,496 | require_relative '../../spec_helper'
describe FioAPI::ListResponseDeserializer do
describe 'instance attributes' do
it 'should respond to account' do
expect(FioAPI::ListResponseDeserializer.new('{}', '')).to respond_to(:account)
end
it 'should respond to transactions' do
expect(FioAPI::ListR... |
github | 14113/fio_api | https://github.com/14113/fio_api | spec/base/deserializers/import_response_deserializer_spec.rb | Ruby | mit | 18 | master | 1,430 | require_relative '../../spec_helper'
describe FioAPI::ImportResponseDeserializer do
describe 'instance attributes' do
it 'should respond to status' do
expect(FioAPI::ImportResponseDeserializer.new('{}', '')).to respond_to(:status)
end
end
describe 'deserialization' do
before(:each) do
@d... |
github | 14113/fio_api | https://github.com/14113/fio_api | spec/utils/hash_spec.rb | Ruby | mit | 18 | master | 676 | require_relative '../spec_helper'
describe Hash do
describe 'try_path' do
it 'should respond to try_path method' do
expect({}).to respond_to(:try_path)
end
it "should return nil if can't find key" do
expect({}.try_path('key1', 'key2')).to be_nil
end
it 'should return value on path' ... |
github | format-message/message-format-rb | https://github.com/format-message/message-format-rb | message_format.gemspec | Ruby | mit | 18 | master | 1,171 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'message_format/version'
Gem::Specification.new do |spec|
spec.name = "message_format"
spec.version = MessageFormat::VERSION
spec.authors = ["Andy VanWagoner"]
spec.em... |
github | format-message/message-format-rb | https://github.com/format-message/message-format-rb | benchmark.rb | Ruby | mit | 18 | master | 1,667 | require 'benchmark'
require_relative 'lib/message_format'
iterations = 100_000
Benchmark.bm do |bm|
bm.report('parse simple message') do
parser = MessageFormat::Parser.new()
iterations.times do
parser.parse("I'm a super simple message")
end
end
bm.report('format simple message') do
messag... |
github | format-message/message-format-rb | https://github.com/format-message/message-format-rb | lib/message_format.rb | Ruby | mit | 18 | master | 1,125 | require 'twitter_cldr'
require_relative 'message_format/version'
require_relative 'message_format/parser'
require_relative 'message_format/interpreter'
module MessageFormat
class MessageFormat
def initialize ( pattern, locale=nil, raise_on_missing_params: false )
@locale = (locale || TwitterCldr.locale).t... |
github | format-message/message-format-rb | https://github.com/format-message/message-format-rb | lib/message_format/parser.rb | Ruby | mit | 18 | master | 9,465 | # frozen_string_literal: true
#
# Parser
#
# Turns this:
# `You have { numBananas, plural,
# =0 {no bananas}
# one {a banana}
# other {# bananas}
# } for sale`
#
# into this:
# [ "You have ", [ "numBananas", "plural", 0, {
# "=0": [ "no bananas" ],
# "one": [ "a banana" ],
# "other": [ [ ... |
github | format-message/message-format-rb | https://github.com/format-message/message-format-rb | lib/message_format/interpreter.rb | Ruby | mit | 18 | master | 5,642 | require 'twitter_cldr'
#
# Interpreter
#
# Turns this:
# [ "You have ", [ "numBananas", "plural", 0, {
# "=0": [ "no bananas" ],
# "one": [ "a banana" ],
# "other": [ [ '#' ], " bananas" ]
# } ], " for sale." ]
#
# into this:
# format({ numBananas:0 })
# "You have no bananas for sale."
#
module Messa... |
github | format-message/message-format-rb | https://github.com/format-message/message-format-rb | spec/message_format_spec.rb | Ruby | mit | 18 | master | 5,651 | require 'spec_helper'
describe MessageFormat do
describe '.new' do
it 'throws an error on bad syntax' do
expect { MessageFormat.new({}) }.to raise_error
expect { MessageFormat.new('no finish arg {') }.to raise_error
expect { MessageFormat.new('no start arg }') }.to raise_error
expect { Me... |
github | test-prof/test-prof-aiptimize-action | https://github.com/test-prof/test-prof-aiptimize-action | main.rb | Ruby | mit | 18 | main | 7,025 | # frozen_string_literal: true
require "bundler/inline"
gemfile(true, quiet: true) do
source "https://rubygems.org"
gem "octokit"
gem "base64"
gem "open3"
gem "anthropic", "~> 0.2.0"
end
# Core helpers
class CommandResult < Struct.new(:success, :output)
def success?
success
end
end
def log!(msg)
... |
github | future-architect/redmine_gitlab_adapter | https://github.com/future-architect/redmine_gitlab_adapter | init.rb | Ruby | mit | 18 | master | 372 | require 'redmine'
require 'gitlab_repositories_helper_patch'
Redmine::Plugin.register :redmine_gitlab_adapter do
name 'Redmine Gitlab Adapter plugin'
author 'Future Corporation'
description 'This is a Gitlab Adapter plugin for Redmine'
version '0.2.1'
url 'https://www.future.co.jp'
author_url 'https://www.... |
github | future-architect/redmine_gitlab_adapter | https://github.com/future-architect/redmine_gitlab_adapter | lib/gitlab_repositories_helper_patch.rb | Ruby | mit | 18 | master | 1,432 | require_dependency 'repositories_helper'
module GitlabRepositoriesHelperPatch
def self.included(base)
base.send(:include, InstanceMethods)
end
module InstanceMethods
def gitlab_field_tags(form, repository)
content_tag('p', form.text_field(:url, :size => 60, :required => true,
... |
github | future-architect/redmine_gitlab_adapter | https://github.com/future-architect/redmine_gitlab_adapter | lib/redmine/scm/adapters/gitlab_adapter.rb | Ruby | mit | 18 | master | 12,324 | require 'redmine/scm/adapters/abstract_adapter'
require 'uri'
require 'no_proxy_fix'
module Redmine
module Scm
module Adapters
class GitlabAdapter < AbstractAdapter
# Git executable name
GITLAB_BIN = "gitlab"
# Repositories created after 2020 may have a default branch of
# ... |
github | future-architect/redmine_gitlab_adapter | https://github.com/future-architect/redmine_gitlab_adapter | app/models/repository/gitlab.rb | Ruby | mit | 18 | master | 5,195 | require 'redmine/scm/adapters/gitlab_adapter'
class Repository::Gitlab < Repository
validates_presence_of :url, :password
validates_format_of :url, :with => %r{\A(http|https):\/\/.+}i
safe_attributes 'root_url', 'report_last_commit'
validates_format_of :root_url, :allow_blank => true, :with => %r{\A(http|https... |
github | avantsoftware/fastframe | https://github.com/avantsoftware/fastframe | Gemfile | Ruby | mit | 18 | master | 228 | # frozen_string_literal: true
source "https://rubygems.org"
# Specify your gem's dependencies in fastframe.gemspec
gemspec
gem "irb"
gem "rake", "~> 13.0"
gem "rspec", "~> 3.0"
gem "rubocop", "~> 1.21"
gem "activesupport" |
github | avantsoftware/fastframe | https://github.com/avantsoftware/fastframe | fastframe.gemspec | Ruby | mit | 18 | master | 1,290 | # frozen_string_literal: true
require_relative "lib/fastframe/version"
Gem::Specification.new do |spec|
spec.name = "fastframe"
spec.version = Fastframe::VERSION
spec.authors = ["Albert Alef"]
spec.email = ["albertalef@protonmail.com"]
spec.summary = "Fast and Beautiful Serializer"
spec.description = "Fa... |
github | avantsoftware/fastframe | https://github.com/avantsoftware/fastframe | spec/spec_helper.rb | Ruby | mit | 18 | master | 445 | # frozen_string_literal: true
require "fastframe"
Dir[File.join(__dir__, "support", "**", "*.rb")].each { |f| require f }
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 o... |
github | avantsoftware/fastframe | https://github.com/avantsoftware/fastframe | spec/fastframe/field_spec.rb | Ruby | mit | 18 | master | 4,803 | # frozen_string_literal: true
RSpec.describe Fastframe::Field do
def build_entity(attrs = {})
obj = Object.new
attrs.each do |key, value|
obj.define_singleton_method(key) { value }
end
obj
end
describe 'Extraction' do
context 'when using a simple field' do
let(:frame) do
... |
github | avantsoftware/fastframe | https://github.com/avantsoftware/fastframe | spec/fastframe/association_spec.rb | Ruby | mit | 18 | master | 6,138 | # frozen_string_literal: true
RSpec.describe Fastframe::Association do
def build_entity(attrs = {})
obj = Object.new
attrs.each do |key, value|
obj.define_singleton_method(key) { value }
end
obj
end
describe 'Rendering' do
context 'when association points to a single entity' do
l... |
github | avantsoftware/fastframe | https://github.com/avantsoftware/fastframe | spec/fastframe/condition_spec.rb | Ruby | mit | 18 | master | 4,697 | # frozen_string_literal: true
RSpec.describe Fastframe::Condition do
def build_entity(attrs = {})
obj = Object.new
attrs.each do |key, value|
obj.define_singleton_method(key) { value }
end
obj
end
describe 'Conditional Rendering' do
context 'when condition is a Symbol (method call)' do... |
github | avantsoftware/fastframe | https://github.com/avantsoftware/fastframe | spec/fastframe/frame_spec.rb | Ruby | mit | 18 | master | 6,541 | # frozen_string_literal: true
RSpec.describe Fastframe::Frame do
def build_entity(attrs = {})
obj = Object.new
attrs.each do |key, value|
obj.define_singleton_method(key) { value }
end
obj
end
describe 'Rendering A Single Entity' do
let(:frame) do
FrameStub.new do
fields ... |
github | avantsoftware/fastframe | https://github.com/avantsoftware/fastframe | lib/fastframe.rb | Ruby | mit | 18 | master | 374 | # frozen_string_literal: true
require "active_support/core_ext/object/inclusion"
require "active_support/core_ext/object/blank"
require_relative "fastframe/version"
require_relative "fastframe/field"
require_relative "fastframe/association"
require_relative "fastframe/condition"
require_relative "fastframe/frame"
mo... |
github | avantsoftware/fastframe | https://github.com/avantsoftware/fastframe | lib/fastframe/frame.rb | Ruby | mit | 18 | master | 2,437 | # frozen_string_literal: true
module Fastframe
class Frame
class << self
def fields(*field_names)
field_names.filter { |b| b.class.in?([String, Symbol]) }.each do |field_name|
defined_fields << Field.new(field_name, {})
end
end
def field(field_name, options = {}, &)
... |
github | avantsoftware/fastframe | https://github.com/avantsoftware/fastframe | lib/fastframe/condition.rb | Ruby | mit | 18 | master | 650 | # frozen_string_literal: true
module Fastframe
class Condition
attr_reader :validation_entry, :frame, :options
def initialize(validation_entry, frame, options)
@validation_entry = validation_entry
@frame = frame
@options = options
end
def applies?(entity)
case @validation_en... |
github | avantsoftware/fastframe | https://github.com/avantsoftware/fastframe | lib/fastframe/association.rb | Ruby | mit | 18 | master | 942 | # frozen_string_literal: true
module Fastframe
class Association
attr_reader :name, :frame, :options
def initialize(name, frame, options)
@name = name
@frame = frame
@options = options
end
def relation_name
final_name = @options[:as]
final_name ||= name
final_na... |
github | avantsoftware/fastframe | https://github.com/avantsoftware/fastframe | lib/fastframe/field.rb | Ruby | mit | 18 | master | 765 | # frozen_string_literal: true
module Fastframe
class Field
attr_reader :name, :options, :block
def initialize(name, options, &block)
@name = name
@options = options
@block = block
end
def relation_name
final_name = @options[:as]
final_name ||= name
final_name = ... |
github | Helveg/jekyll-gfm-admonitions | https://github.com/Helveg/jekyll-gfm-admonitions | jekyll-gfm-admonitions.gemspec | Ruby | mit | 18 | main | 1,082 | # frozen_string_literal: true
# jekyll-gfm-admonitions.gemspec
Gem::Specification.new do |spec|
spec.name = 'jekyll-gfm-admonitions'
spec.version = '1.4.2'
spec.authors = ['Robin De Schepper']
spec.email = ['robin.deschepper93@gmail.com']
spec.summary = 'A Jekyll plugin t... |
github | Helveg/jekyll-gfm-admonitions | https://github.com/Helveg/jekyll-gfm-admonitions | Gemfile | Ruby | mit | 18 | main | 243 | # frozen_string_literal: true
source 'https://rubygems.org'
gem 'jekyll'
group :development do
gem 'rake', '~> 13.0'
gem 'rspec', '~> 3.13'
end
group :jekyll_plugins do
gem 'github-pages'
gem 'jekyll-gfm-admonitions', path: '.'
end |
github | Helveg/jekyll-gfm-admonitions | https://github.com/Helveg/jekyll-gfm-admonitions | lib/jekyll-gfm-admonitions.rb | Ruby | mit | 18 | main | 6,880 | # frozen_string_literal: true
require 'octicons'
require 'cssminify'
require 'liquid/template'
ADMONITION_ICONS = {
'important' => 'report',
'note' => 'info',
'tip' => 'light-bulb',
'warning' => 'alert',
'caution' => 'stop'
}.freeze
# JekyllGFMAdmonitions is a module that provides functionality to process ... |
github | Helveg/jekyll-gfm-admonitions | https://github.com/Helveg/jekyll-gfm-admonitions | spec/jekyll_gfm_admonitions_spec.rb | Ruby | mit | 18 | main | 8,574 | # frozen_string_literal: true
require 'spec_helper'
DocStub = Struct.new(:content, :path)
RSpec.describe JekyllGFMAdmonitions::GFMAdmonitionConverter do
let(:markdown_converter) { double('Jekyll::Converters::Markdown') }
subject(:converter) do
obj = described_class.allocate
obj.instance_variable_set(:@m... |
github | Helveg/jekyll-gfm-admonitions | https://github.com/Helveg/jekyll-gfm-admonitions | spec/spec_helper.rb | Ruby | mit | 18 | main | 1,077 | # frozen_string_literal: true
# Require liquid before stubbing Jekyll so its constants are properly set up
require 'liquid'
# Stub Jekyll constants so we can load the plugin without a full Jekyll install
# in a bare RSpec run.
unless defined?(Jekyll)
module Jekyll
def self.logger
@logger ||= begin
... |
github | Helveg/jekyll-gfm-admonitions | https://github.com/Helveg/jekyll-gfm-admonitions | sample-github-pages/Gemfile | Ruby | mit | 18 | main | 208 | # frozen_string_literal: true
source 'https://rubygems.org'
gem 'github-pages', group: :jekyll_plugins
gem 'jekyll'
gem 'jekyll-gfm-admonitions', path: '..', group: :jekyll_plugins
gem 'jekyll-remote-theme' |
github | Helveg/jekyll-gfm-admonitions | https://github.com/Helveg/jekyll-gfm-admonitions | sample/Gemfile | Ruby | mit | 18 | main | 273 | # frozen_string_literal: true
source 'https://rubygems.org'
gem 'jekyll', '~> 4.0'
gem 'jekyll-gfm-admonitions', path: '..', group: :jekyll_plugins
gem 'jekyll-remote-theme'
# Ruby 3.4 removed these from default gems; Jekyll 4.x still requires them
gem 'csv'
gem 'base64' |
github | skatkov/yard-markdown | https://github.com/skatkov/yard-markdown | Rakefile | Ruby | mit | 18 | main | 6,008 | # frozen_string_literal: true
require "fileutils"
require "open3"
require "shellwords"
require "bundler/gem_tasks"
require "rake/testtask"
require_relative "test/support/markdown_validator"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/test_*.rb"]
end
task... |
github | skatkov/yard-markdown | https://github.com/skatkov/yard-markdown | example_rdoc.rb | Ruby | mit | 18 | main | 2,668 | ##
# === RDoc::Generator::Markdown example.
#
# This example employs various RDoc features to demonstrate
# generator output.
#
# ---
#
# Links:
#
# 1. {Project Home Page}[https://github.com/skatkov/rdoc-markdown)
# 2. {RDoc Documentation}[http://ruby-doc.org/stdlib-2.0.0/libdoc/rdoc/rdoc/RDoc/Markup.html]
#
##
# A ... |
github | skatkov/yard-markdown | https://github.com/skatkov/yard-markdown | Gemfile | Ruby | mit | 18 | main | 356 | # frozen_string_literal: true
source "https://rubygems.org"
# Specify your gem's dependencies in yard-markdown.gemspec
gemspec
gem "rake", "~> 13.0"
gem "minitest", "~> 5.0"
gem "minitest-strict"
gem "mutant"
gem "mutant-minitest"
gem "mutex_m"
gem "commonmarker"
gem "redcarpet"
# gem "ruby-lsp"
gem "yard"
gem "ya... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.