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
marcoroth/turbo-ruby
https://github.com/marcoroth/turbo-ruby
turbo-ruby.gemspec
Ruby
mit
45
main
962
# frozen_string_literal: true require_relative "lib/turbo/ruby/version" Gem::Specification.new do |spec| spec.name = "turbo-ruby" spec.version = Turbo::Ruby::VERSION spec.authors = ["Marco Roth"] spec.email = ["marco.roth@intergga.ch"] spec.summary = "Turbo helpers without the requirement for Rails" spec...
github
marcoroth/turbo-ruby
https://github.com/marcoroth/turbo-ruby
test/turbo/test_ruby.rb
Ruby
mit
45
main
201
# frozen_string_literal: true require "test_helper" module Turbo class TestRuby < Minitest::Test def test_that_it_has_a_version_number refute_nil ::Turbo::Ruby::VERSION end end end
github
marcoroth/turbo-ruby
https://github.com/marcoroth/turbo-ruby
lib/turbo/ruby.rb
Ruby
mit
45
main
259
# frozen_string_literal: true require "phlex" require_relative "ruby/version" require_relative "ruby/helpers" require_relative "elements" require_relative "elements/turbo_stream" require_relative "elements/turbo_frame" module Turbo module Ruby end end
github
marcoroth/turbo-ruby
https://github.com/marcoroth/turbo-ruby
lib/turbo/elements/turbo_frame.rb
Ruby
mit
45
main
598
# frozen_string_literal: true module Turbo module Elements class TurboFrame < Phlex::HTML register_element :turbo_frame def initialize(src:, loading:, disabled:, target:, autoscroll:) @src = src @loading = loading @disabled = disabled @target = target @autoscr...
github
marcoroth/turbo-ruby
https://github.com/marcoroth/turbo-ruby
lib/turbo/elements/turbo_stream.rb
Ruby
mit
45
main
1,879
# frozen_string_literal: true module Turbo module Elements class TurboStream < Phlex::HTML register_element :turbo_stream def initialize(view_context: nil, action: nil, target: nil, targets: nil, content: nil, allow_inferred_rendering: true, attributes: {}, **rendering, &block) ...
github
marcoroth/turbo-ruby
https://github.com/marcoroth/turbo-ruby
lib/turbo/ruby/helpers.rb
Ruby
mit
45
main
867
# frozen_string_literal: true module Turbo module Ruby module Helpers def action(...) self.class.action(...) end def self.action(name, target, content = nil, view_context: nil, allow_inferred_rendering: true, attributes: {}, **rendering, &block) TurboStrea...
github
mmower/simply_versioned
https://github.com/mmower/simply_versioned
Rakefile
Ruby
mit
46
master
868
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the simply_versioned plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the simply_versio...
github
mmower/simply_versioned
https://github.com/mmower/simply_versioned
generators/simply_versioned_migration/simply_versioned_migration_generator.rb
Ruby
mit
46
master
235
class SimplyVersionedMigrationGenerator < Rails::Generator::Base def manifest record do |m| m.migration_template 'migration.rb', 'db/migrate' end end def file_name "simply_versioned_migration" end end
github
mmower/simply_versioned
https://github.com/mmower/simply_versioned
generators/simply_versioned_migration/templates/migration.rb
Ruby
mit
46
master
393
class SimplyVersionedMigration < ActiveRecord::Migration def self.up create_table :versions do |t| t.integer :versionable_id t.string :versionable_type t.integer :number t.text :yaml t.datetime :created_at end add_index :versions, [:versionable_id, :versi...
github
mmower/simply_versioned
https://github.com/mmower/simply_versioned
test/test_helper.rb
Ruby
mit
46
master
1,583
ENV["RAILS_ENV"] = "test" TEST_FOLDER = File.dirname( __FILE__ ) $:.unshift( File.join( TEST_FOLDER, '..', 'lib' ) ) HOST_APP_FOLDER = File.expand_path( ENV['HOST_APP'] || File.join( TEST_FOLDER, '..', '..', '..' ) ) puts "Host application: #{HOST_APP_FOLDER}" require 'test/unit' require File.expand_path( File.join(...
github
mmower/simply_versioned
https://github.com/mmower/simply_versioned
test/simply_versioned_test.rb
Ruby
mit
46
master
8,598
require File.join( File.dirname( __FILE__ ), 'test_helper' ) require 'mocha' class Aardvark < ActiveRecord::Base simply_versioned :keep => 3 end class Gnu < ActiveRecord::Base simply_versioned :keep => 4 end class Undine < ActiveRecord::Base end class Heffalump < ActiveRecord::Base simply_versioned :automati...
github
mmower/simply_versioned
https://github.com/mmower/simply_versioned
lib/simply_versioned.rb
Ruby
mit
46
master
7,423
# SimplyVersioned 1.0.0 # # Simple ActiveRecord versioning # Copyright (c) 2007,2008 Matt Mower <self@mattmower.com> # Released under the MIT license (see accompany MIT-LICENSE file) # module SoftwareHeretics module ActiveRecord module SimplyVersioned class BadOptions < StandardError d...
github
mmower/simply_versioned
https://github.com/mmower/simply_versioned
lib/version.rb
Ruby
mit
46
master
1,394
# SimplyVersioned 1.0.0 # # Simple ActiveRecord versioning # Copyright (c) 2007,2008 Matt Mower <self@mattmower.com> # Released under the MIT license (see accompany MIT-LICENSE file) # # A Version represents a numbered revision of an ActiveRecord model. # # The version has two attributes +number+ and +yaml+ where the ...
github
theodorton/yard-activerecord
https://github.com/theodorton/yard-activerecord
yard-activerecord.gemspec
Ruby
mit
45
main
921
require_relative "lib/yard-activerecord/version" Gem::Specification.new do |s| s.name = "yard-activerecord" s.version = YARD::ActiveRecord::VERSION s.authors = ["Theodor Tonum"] s.email = ["theodor@tonum.no"] s.homepage = "https://github.com/theodorton/yard-activerecord" s.summary ...
github
theodorton/yard-activerecord
https://github.com/theodorton/yard-activerecord
templates/default/tags/setup.rb
Ruby
mit
45
main
659
def init super if object.has_tag?(:validates) create_tag_methods([:validates]) sections << Section.new(:validates) end end def validates all_tags = object.tags(:validates) out = '' conditions = all_tags.map{| tag | tag.pair.to_s }.uniq.compact conditions.each do | condition | @tags = all_tags...
github
theodorton/yard-activerecord
https://github.com/theodorton/yard-activerecord
lib/yard-activerecord.rb
Ruby
mit
45
main
922
require 'yard' require 'active_support' require 'active_support/inflector' require 'active_support/core_ext/array' module YARD::Handlers::Ruby::ActiveRecord end YARD::Templates::Engine.register_template_path File.dirname(__FILE__) + '/../templates' root = File.expand_path(File.dirname(__FILE__)) $LOAD_PATH << root u...
github
theodorton/yard-activerecord
https://github.com/theodorton/yard-activerecord
lib/yard-activerecord/validations/validates_handler.rb
Ruby
mit
45
main
3,392
module YARD::Handlers::Ruby::ActiveRecord::Validate # Links with a value of nil will be link to # the Rails Validations guide. # Other projects can add to the STANDARD_LINKS = [ :acceptance, :validates_associated, :confirmation, :exclusion, :format, :inclusion, :length, :numeric...
github
theodorton/yard-activerecord
https://github.com/theodorton/yard-activerecord
lib/yard-activerecord/associations/base.rb
Ruby
mit
45
main
1,614
require 'yard' module YARD::Handlers::Ruby::ActiveRecord::Associations class Base < YARD::Handlers::Ruby::MethodHandler namespace_only def process namespace.groups << group_name unless namespace.groups.include? group_name object = register YARD::CodeObjects::MethodObject.new(namespace...
github
theodorton/yard-activerecord
https://github.com/theodorton/yard-activerecord
lib/yard-activerecord/associations/singular_handler.rb
Ruby
mit
45
main
266
require_relative 'base' module YARD::Handlers::Ruby::ActiveRecord::Associations class SingularHandler < Base def class_name super(false) end private def return_description "An associated {#{method_name.humanize}}" end end end
github
theodorton/yard-activerecord
https://github.com/theodorton/yard-activerecord
lib/yard-activerecord/associations/belongs_to_handler.rb
Ruby
mit
45
main
287
require_relative 'singular_handler' module YARD::Handlers::Ruby::ActiveRecord::Associations class BelongsToHandler < SingularHandler handles method_call(:belongs_to) def group_name 'Belongs to' end private def return_description '' end end end
github
theodorton/yard-activerecord
https://github.com/theodorton/yard-activerecord
lib/yard-activerecord/associations/has_many_handler.rb
Ruby
mit
45
main
276
require_relative 'plural_handler' module YARD::Handlers::Ruby::ActiveRecord::Associations class HasManyHandler < PluralHandler handles method_call(:has_many) def group_name 'Has many' end private def return_description '' end end end
github
theodorton/yard-activerecord
https://github.com/theodorton/yard-activerecord
lib/yard-activerecord/associations/plural_handler.rb
Ruby
mit
45
main
386
require_relative 'base' module YARD::Handlers::Ruby::ActiveRecord::Associations class PluralHandler < Base def class_name "ActiveRecord::Relation<#{super(true)}>" end private def return_description "A relationship to the associated #{method_name.humanize} that can have further scopes cha...
github
theodorton/yard-activerecord
https://github.com/theodorton/yard-activerecord
lib/yard-activerecord/associations/has_and_belongs_to_many_handler.rb
Ruby
mit
45
main
319
require_relative 'plural_handler' module YARD::Handlers::Ruby::ActiveRecord::Associations class HasAndBelongsToManyHandler < PluralHandler handles method_call(:has_and_belongs_to_many) def group_name 'Has and belongs to many' end private def return_description '' end end end
github
theodorton/yard-activerecord
https://github.com/theodorton/yard-activerecord
lib/yard-activerecord/associations/has_one_handler.rb
Ruby
mit
45
main
277
require_relative 'singular_handler' module YARD::Handlers::Ruby::ActiveRecord::Associations class HasOneHandler < SingularHandler handles method_call(:has_one) def group_name 'Has one' end private def return_description '' end end end
github
theodorton/yard-activerecord
https://github.com/theodorton/yard-activerecord
lib/yard-activerecord/fields/field_handler.rb
Ruby
mit
45
main
1,894
module YARD::Handlers::Ruby::ActiveRecord::Fields class FieldHandler < YARD::Handlers::Ruby::MethodHandler in_file 'schema.rb' handles method_call(:string) handles method_call(:text) handles method_call(:integer) handles method_call(:float) handles method_call(:boolean) handles method_cal...
github
theodorton/yard-activerecord
https://github.com/theodorton/yard-activerecord
lib/yard-activerecord/fields/create_table_handler.rb
Ruby
mit
45
main
621
require 'yard' module YARD::Handlers::Ruby::ActiveRecord::Fields class CreateTableHandler < YARD::Handlers::Ruby::MethodHandler handles method_call(:create_table) def process return unless globals.ar_schema table_name = call_params.first class_name_regex = table_name. singularize. ...
github
theodorton/yard-activerecord
https://github.com/theodorton/yard-activerecord
lib/yard-activerecord/fields/define_handler.rb
Ruby
mit
45
main
342
module YARD::Handlers::Ruby::ActiveRecord::Fields class DefineHandler < YARD::Handlers::Ruby::MethodHandler handles method_call(:define) def process if statement.file == 'db/schema.rb' globals.ar_schema = true parse_block(statement.last.last) globals.ar_schema = false ...
github
theodorton/yard-activerecord
https://github.com/theodorton/yard-activerecord
lib/yard-activerecord/scopes/scope_handler.rb
Ruby
mit
45
main
1,045
module YARD::Handlers::Ruby::ActiveRecord::Scopes class ScopeHandler < YARD::Handlers::Ruby::MethodHandler handles method_call(:scope) namespace_only def process object = register YARD::CodeObjects::MethodObject.new(namespace, method_name, :class) object.docstring = return_description o...
github
theodorton/yard-activerecord
https://github.com/theodorton/yard-activerecord
lib/yard-activerecord/delegations/delegate_handler.rb
Ruby
mit
45
main
1,822
require 'yard' module YARD::Handlers::Ruby::ActiveRecord::Delegations class DelegateHandler < YARD::Handlers::Ruby::MethodHandler handles method_call(:delegate) namespace_only def process params = statement.parameters params.pop # we shouldn't have a block, so pop that off params.map! ...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
openassets-ruby.gemspec
Ruby
mit
45
master
1,371
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'openassets/version' Gem::Specification.new do |spec| spec.name = "openassets-ruby" spec.version = OpenAssets::VERSION spec.authors = ["azuchi"] spec.email = [...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
spec/spec_helper.rb
Ruby
mit
45
master
2,023
# $LOAD_PATH.unshift File.expand_path('../lib', __FILE__) require 'rubygems' require 'openassets' require 'json' RSpec.configure do |config| config.before(:each) do |example| if example.metadata[:network] == :testnet Bitcoin.network = :testnet3 elsif example.metadata[:network] == :litecoin Bitcoi...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
spec/openassets/api_spec.rb
Ruby
mit
45
master
38,198
require 'spec_helper' describe 'OpenAssets::Api use mainnet' do include OpenAssets::Util it 'load configuration' do api = OpenAssets::Api.new expect(api.is_testnet?).to be false expect(api.config[:rpc][:host]).to eq('localhost') expect(api.config[:rpc][:port]).to eq(8332) expect(api.config[:r...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
spec/openassets/api_testnet_spec.rb
Ruby
mit
45
master
20,903
require 'spec_helper' describe 'OpenAssets::Api use testnet', :network => :testnet do include OpenAssets::Util extend OpenAssets::Util context 'testnet' do describe 'list_unspent' do subject{ create_api.list_unspent } it do expect(subject[0]['txid']).to eq('e1dcdb553d40ec...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
spec/openassets/method_filter_spec.rb
Ruby
mit
45
master
392
require 'spec_helper' describe OpenAssets::MethodFilter do it 'before filter' do class FilterSpec include OpenAssets::MethodFilter before_filter :before, {:include => [:hoge]} def hoge puts "hoge" end def before puts "before" end end s = FilterSpec....
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
spec/openassets/util_spec.rb
Ruby
mit
45
master
2,898
require 'spec_helper' describe OpenAssets::Util do let(:test_class) {Struct.new(:util) {include OpenAssets::Util}} let(:util) {test_class.new} context 'mainnet' do it 'convert address ' do btc_address = '1F2AQr6oqNtcJQ6p9SiCLQTrHuM9en44H8' oa_address = 'akQz3f1v9JrnJAeGBC4pNzGNRdWXKan4U6E' ...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
spec/openassets/transaction/out_point_spec.rb
Ruby
mit
45
master
629
require 'spec_helper' describe OpenAssets::Transaction::OutPoint do it "initialize success" do out_point = OpenAssets::Transaction::OutPoint.new('8a7e2adf117199f93c8515266497d2b9954f3f3dea0f043e06c19ad2b21b8220', 0) expect(out_point.hash).to eq('8a7e2adf117199f93c8515266497d2b9954f3f3dea0f043e06c19ad2b21b82...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
spec/openassets/transaction/spendable_output_spec.rb
Ruby
mit
45
master
3,389
require 'spec_helper' describe OpenAssets::Transaction::SpendableOutput, :network => :testnet do it 'to hash' do issue_spec = Bitcoin::Protocol::Tx.new('010000000154f5a67cb14d7e50056f53263b72165daaf438164e7e825b862b9062a4e40612000000006b48304502210098e16e338e9600876e30d9dc0894bcd1bbb612431e7a36732c5feab0686d064...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
spec/openassets/transaction/transaction_builder_spec.rb
Ruby
mit
45
master
11,378
require 'spec_helper' describe OpenAssets::Transaction::TransactionBuilder do include OpenAssets::Util it 'issue asset success' do unspent_outputs = gen_outputs( [[20, 'source', 'ALn3aK1fSuG27N96UGYB1kUYUpGKRhBuBC', 50, '8a7e2adf117199f93c8515266497d2b9954f3f3dea0f043e06c19ad2b21b8220'], [15,...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
spec/openassets/provider/bitcoin_core_provider_spec.rb
Ruby
mit
45
master
18,232
require 'spec_helper' describe OpenAssets::Provider::BitcoinCoreProvider do describe 'implicitly defined method#getbalance' do context 'use new provider.getbalance' do it 'returns provider.getbalance' do provider = OpenAssets::Provider::BitcoinCoreProvider.new({}) expect(provider).to receiv...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
spec/openassets/cache/ssl_certificate_cache_spec.rb
Ruby
mit
45
master
611
require 'spec_helper' require 'timecop' describe OpenAssets::Cache::SSLCertificateCache do before :all do Timecop.freeze(Time.new(2016,2,21)) end after :all do Timecop.return end subject{ OpenAssets::Cache::SSLCertificateCache.new } it 'check expire date' do url = 'https://s3-ap-northe...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
spec/openassets/cache/output_cache_spec.rb
Ruby
mit
45
master
1,155
require 'spec_helper' describe OpenAssets::Cache::OutputCache do subject{ OpenAssets::Cache::OutputCache.new(':memory:') } it 'output cache' do txid = '7ed86d1c2824ea14bf8a2fe27202a1d229a4f58db52e2ba1ed13cf36765deaac' index = 0 output = OpenAssets::Protocol::TransactionOutput.new( 100, B...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
spec/openassets/cache/transaction_cache_spec.rb
Ruby
mit
45
master
3,737
require 'spec_helper' describe OpenAssets::Cache::TransactionCache do subject{ OpenAssets::Cache::TransactionCache.new(':memory:') } it 'get' do expect(subject.get('41fbb44dd78a11f8a1188983dfd63e70e47be94f7e644d20e2e673e811535bde')).to be nil end it 'put' do txid = '7ed86d1c2824ea14bf8a2fe27202...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
spec/openassets/protocol/asset_definition_loader_spec.rb
Ruby
mit
45
master
3,471
require 'spec_helper' describe OpenAssets::Protocol::AssetDefinitionLoader, :network => :testnet do describe 'initialize' do context 'http or https' do subject{ OpenAssets::Protocol::AssetDefinitionLoader.new('http://goo.gl/fS4mEj').loader } it do expect(subject).to be_a(OpenA...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
spec/openassets/protocol/transaction_output_spec.rb
Ruby
mit
45
master
10,314
require 'spec_helper' require 'rest-client' describe OpenAssets::Protocol::TransactionOutput do describe 'initialize' do context 'standard output' do it do target = OpenAssets::Protocol::TransactionOutput.new( 100, Bitcoin::Script.from_string("abcd"), "ALn3aK1fSuG27N96UGYB1kUYUpGKRhBuBC...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
spec/openassets/protocol/asset_definition_spec.rb
Ruby
mit
45
master
3,868
require 'spec_helper' describe OpenAssets::Protocol::AssetDefinition do json = '{"asset_ids":["AGHhobo7pVQN5fZWqv3rhdc324ryT7qVTB","AWo3R89p5REmoSyMWB8AeUmud8456bRxZL","AJk2Gx5V67S2wNuwTK5hef3TpHunfbjcmX"],"version":"1.0","divisibility":1,"name_short":"HAWSCoin","name":"MHAWS Coin","contract_url":"http://techmedia-...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
spec/openassets/protocol/http_asset_definition_loader_spec.rb
Ruby
mit
45
master
1,340
require 'spec_helper' describe OpenAssets::Protocol::HttpAssetDefinitionLoader do describe 'load' do context 'correct content' do subject{ OpenAssets::Protocol::HttpAssetDefinitionLoader.new('http://goo.gl/fS4mEj').load } it do expect(subject.asset_ids.length).to eq(4) ...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets.rb
Ruby
mit
45
master
628
require 'bitcoin' require 'leb128' module OpenAssets autoload :Protocol, 'openassets/protocol' autoload :Transaction, 'openassets/transaction' autoload :VERSION, 'openassets/version' autoload :Util, 'openassets/util' autoload :MethodFilter, 'openassets/medhod_filter' autoload :Api, 'openassets/api' auto...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/util.rb
Ruby
mit
45
master
5,669
require 'bigdecimal' module OpenAssets module Util extend ::Bitcoin::Util include ::Bitcoin::Util # namespace of Open Asset OA_NAMESPACE = 19 # version byte for Open Assets Address OA_VERSION_BYTE = 23 OA_VERSION_BYTE_TESTNET = 115 # convert bitcoin address to open assets address ...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/cache.rb
Ruby
mit
45
master
303
module OpenAssets module Cache autoload :SQLiteBase, 'openassets/cache/sqlite_base' autoload :TransactionCache, 'openassets/cache/transaction_cache' autoload :SSLCertificateCache, 'openassets/cache/ssl_certificate_cache' autoload :OutputCache, 'openassets/cache/output_cache' end end
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/api.rb
Ruby
mit
45
master
20,212
# encoding: ascii-8bit module OpenAssets class Api include Util include MethodFilter before_filter :change_network, {:include => [:list_unspent, :get_balance, :issue_asset, :send_asset, :send_assets, :send_bitcoin, :send_bitcoins]} attr_reader :config attr_reader :provider attr_reader :tx...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/send_asset_param.rb
Ruby
mit
45
master
322
module OpenAssets class SendAssetParam attr_accessor :asset_id attr_accessor :amount attr_accessor :to attr_accessor :from def initialize(asset_id, amount, to, from = nil) @asset_id = asset_id @amount = amount @to = to @from = from end end e...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/provider.rb
Ruby
mit
45
master
266
module OpenAssets module Provider autoload :BlockChainProviderBase, 'openassets/provider/block_chain_provider_base' autoload :BitcoinCoreProvider, 'openassets/provider/bitcoin_core_provider' autoload :ApiError, 'openassets/provider/api_error' end end
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/medhod_filter.rb
Ruby
mit
45
master
1,499
module OpenAssets module MethodFilter module Filters def before_filter(method, options = {}) @before_filters ||= {} @before_filters[method] = options end def filtered_method?(method, options) if options.has_key? :include return true if options[:include].inclu...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/protocol.rb
Ruby
mit
45
master
488
module OpenAssets module Protocol autoload :MarkerOutput, 'openassets/protocol/marker_output' autoload :TransactionOutput, 'openassets/protocol/transaction_output' autoload :OutputType, 'openassets/protocol/output_type' autoload :AssetDefinitionLoader, 'openassets/protocol/asset_definition_loader' ...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/transaction.rb
Ruby
mit
45
master
691
module OpenAssets module Transaction autoload :TransactionBuilder, 'openassets/transaction/transaction_builder' autoload :TransferParameters, 'openassets/transaction/transfer_parameters' autoload :SpendableOutput, 'openassets/transaction/spendable_output' autoload :OutPoint, 'openassets/transaction/ou...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/protocol/output_type.rb
Ruby
mit
45
master
569
# Transaction output type enum module OpenAssets module Protocol module OutputType UNCOLORED = 0 MARKER_OUTPUT = 1 ISSUANCE = 2 TRANSFER = 3 # get all enum. def self.all self.constants.map{|name|self.const_get(name)} end def self.output_type_label(type) ...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/protocol/transaction_output.rb
Ruby
mit
45
master
5,032
module OpenAssets module Protocol # Represents a transaction output and its asset ID and asset quantity. class TransactionOutput include OpenAssets::Util attr_accessor :value attr_accessor :script attr_accessor :asset_id attr_accessor :asset_quantity attr_accessor :outpu...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/protocol/asset_definition.rb
Ruby
mit
45
master
3,678
require 'rest-client' require 'httpclient' module OpenAssets module Protocol # The Definition of Open Asset class AssetDefinition include OpenAssets::MethodFilter before_filter :clear_poa_cache, {:include => [:issuer=, :asset_definition_url=, :link_to_website=]} attr_accessor :asset_defin...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/protocol/asset_definition_loader.rb
Ruby
mit
45
master
1,586
module OpenAssets module Protocol class AssetDefinitionLoader extend Bitcoin::Util extend OpenAssets::Util attr_reader :loader def initialize(url) if url.start_with?('http://') || url.start_with?('https://') @loader = HttpAssetDefinitionLoader.new(url) end ...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/protocol/marker_output.rb
Ruby
mit
45
master
4,635
require 'rest-client' module OpenAssets module Protocol class MarkerOutput include OpenAssets::Util extend OpenAssets::Util MAX_ASSET_QUANTITY = 2 ** 63 -1 # A tag indicating thath this transaction is an Open Assets transaction. OAP_MARKER = "4f41" # The major revision numbe...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/protocol/http_asset_definition_loader.rb
Ruby
mit
45
master
578
module OpenAssets module Protocol # Asset Definition loader for http or https uri scheme class HttpAssetDefinitionLoader attr_reader :url def initialize(url) @url = url end # load asset definition def load begin definition = AssetDefinition.parse_jso...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/transaction/spendable_output.rb
Ruby
mit
45
master
1,082
module OpenAssets module Transaction # A transaction output with information about the asset ID and asset quantity associated to it. class SpendableOutput # An object that can be used to locate the output. attr_accessor :out_point # The actual output object. attr_accessor :output ...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/transaction/transaction_builder.rb
Ruby
mit
45
master
14,195
module OpenAssets module Transaction class TransactionBuilder include OpenAssets::Util # The minimum allowed output value. attr_accessor :amount # The estimated transaction fee rate (satoshis/KB). attr_accessor :efr def initialize(amount = 600, efr = 10000) @a...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/transaction/transfer_parameters.rb
Ruby
mit
45
master
1,359
module OpenAssets module Transaction # The value object of a bitcoin or asset transfer. class TransferParameters attr_accessor :unspent_outputs attr_accessor :amount attr_accessor :change_script attr_accessor :to_script attr_accessor :output_qty # initialize # @par...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/transaction/out_point.rb
Ruby
mit
45
master
620
module OpenAssets module Transaction # The combination of a transaction hash and an index n into its vout class OutPoint attr_accessor :hash attr_accessor :index # @param [String] hash: 32 bytes transaction hash in vout. # @param [Integer] index: index in vout. def initialize(...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/transaction/dust_output_error.rb
Ruby
mit
45
master
202
module OpenAssets module Transaction # The value of an output would be too small, and the output would be considered as dust. class DustOutputError < TransactionBuildError end end end
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/cache/output_cache.rb
Ruby
mit
45
master
1,943
module OpenAssets module Cache # An object that can be used for caching coloring transaction output in a Sqlite database. class OutputCache < SQLiteBase def setup db.execute <<-SQL CREATE TABLE IF NOT EXISTS Output( TransactionHash BLOB, OutputInde...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/cache/transaction_cache.rb
Ruby
mit
45
master
1,080
module OpenAssets module Cache # An object that can be used for caching serialized transaction in a Sqlite database. class TransactionCache < SQLiteBase def setup db.execute <<-SQL CREATE TABLE IF NOT EXISTS Tx( TransactionHash BLOB, SerializedTx B...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/cache/sqlite_base.rb
Ruby
mit
45
master
594
require 'sqlite3' module OpenAssets module Cache # The base class of SQLite3 cache implementation. class SQLiteBase attr_reader :db # Initializes the connection to the database, and creates the table if needed. # @param[String] path The path to the database file. Use ':memory:' for an in...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/cache/ssl_certificate_cache.rb
Ruby
mit
45
master
1,440
module OpenAssets module Cache class SSLCertificateCache < SQLiteBase def initialize path = OpenAssets.configuration ? OpenAssets.configuration[:cache] : ':memory:' super(path) end def setup db.execute <<-SQL CREATE TABLE IF NOT EXISTS SslCertificate( ...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/provider/block_chain_provider_base.rb
Ruby
mit
45
master
433
module OpenAssets module Provider # The base class providing access to the Blockchain. class BlockChainProviderBase def list_unspent(addresses = [], min = 1 , max = 9999999) raise NotImplementedError end def get_transaction(transaction_hash, verbose = 0) raise NotImplement...
github
haw/openassets-ruby
https://github.com/haw/openassets-ruby
lib/openassets/provider/bitcoin_core_provider.rb
Ruby
mit
45
master
5,282
require 'rest-client' module OpenAssets module Provider # The implementation of BlockChain provider using Bitcoin Core. class BitcoinCoreProvider < BlockChainProviderBase attr_reader :config def initialize(config) @config = config commands = request(:help).split("\n").inject([...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
dbview_cti.gemspec
Ruby
mit
45
master
1,150
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "db_view_cti/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "dbview_cti" s.version = DBViewCTI::VERSION s.authors = ["Michaël Van Damme"] s.email = ["mich...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
migrate_up.rb
Ruby
mit
45
master
356
# Small script to run migrations (mainly for use in Travis CI) # set correct rails version rails_major_version = 3 rails_major_version = ENV["RAILS_VERSION"][0] unless ENV["RAILS_VERSION"].nil? # switch to dummy-app for rails version and run migrations Dir.chdir("./spec/dummy-rails-#{rails_major_version}") do syst...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
migrate_down.rb
Ruby
mit
45
master
483
# Small script to roll back migrations (mainly for use in Travis CI) # (we do this to make sure 'rake db:rollback' is also tested) # set correct rails version rails_major_version = 3 rails_major_version = ENV["RAILS_VERSION"][0] unless ENV["RAILS_VERSION"].nil? # switch to dummy-app for rails version and run migrati...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
Rakefile
Ruby
mit
45
master
616
#!/usr/bin/env rake require 'rspec/core/rake_task' begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end begin require 'rdoc/task' rescue LoadError require 'rdoc/rdoc' require 'rake/rdoctask' RDoc::Task = Rake::RDocTask end RDoc::T...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
Gemfile
Ruby
mit
45
master
1,619
source "http://rubygems.org" # Declare your gem's dependencies in view_based_cti.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec # jquery-rails is used by the dummy application #gem "jquery-rails" # ...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/dbview_cti.rb
Ruby
mit
45
master
1,296
ActiveSupport::Inflector.inflections do |inflect| inflect.acronym('CTI') inflect.acronym('CTIs') end module DBViewCTI extend ActiveSupport::Autoload autoload :Names autoload :SchemaDumper module ConnectionAdapters extend ActiveSupport::Autoload autoload :SchemaStatements end module Migration ...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/loader.rb
Ruby
mit
45
master
557
module DBViewCTI def self.load ActiveRecord::ConnectionAdapters::AbstractAdapter.module_eval do include DBViewCTI::ConnectionAdapters::SchemaStatements end ActiveRecord::SchemaDumper.class_eval do include DBViewCTI::SchemaDumper end if defined?(ActiveRecord::Migration::CommandRecord...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/schema_dumper.rb
Ruby
mit
45
master
1,491
# this file is inspired by schema_dumper.rb in the foreigner gem # ( https://github.com/matthuhiggins/foreigner ) module DBViewCTI module SchemaDumper extend ActiveSupport::Concern included do alias_method :tables_without_cti_views, :tables alias_method :tables, :tables_with_cti_views end ...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/names.rb
Ruby
mit
45
master
720
module DBViewCTI module Names def self.view_name(klass) self.table_name(klass) + '_view' end def self.table_name(klass) ActiveSupport::Inflector.tableize( self.class_name(klass) ) end def self.foreign_key(klass) ActiveSupport::Inflector.foreign_key( self.class_name(k...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/migration/command_recorder.rb
Ruby
mit
45
master
325
module DBViewCTI module Migration module CommandRecorder def cti_create_view(*args) record(:cti_create_view, args) end def cti_drop_view(*args) record(:cti_drop_view, args) end def invert_cti_create_view(args) [:cti_drop_view, args] end end end...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/model/extensions.rb
Ruby
mit
45
master
2,353
module DBViewCTI module Model module Extensions extend ActiveSupport::Concern module ClassMethods def cti_base_class self.class_eval { include(DBViewCTI::Model::CTI) } @cti_base_class = true cti_redefine_remote_associations end d...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/model/model_delegator.rb
Ruby
mit
45
master
1,873
require 'delegate' module DBViewCTI module Model class ModelDelegator < SimpleDelegator attr_reader :cti_target_class def initialize(object, target_class) @cti_object = object @cti_converted_object = object.convert_to(target_class) if !@cti_converted_object ...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/model/cti.rb
Ruby
mit
45
master
265
module DBViewCTI module Model module CTI extend ActiveSupport::Concern include Hierarchy include TypeConversion include Destroy include SQL include Associations include AssociationValidations end end end
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/model/collection_delegator.rb
Ruby
mit
45
master
1,003
require 'delegate' module DBViewCTI module Model class CollectionDelegator < SimpleDelegator def initialize(object, target_class_name) super(object) @target_class_name = target_class_name end def <<(object, *args, &block) __getobj__.send('<<', object.try(:convert...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/model/cti/hierarchy.rb
Ruby
mit
45
master
2,018
module DBViewCTI module Model module CTI module Hierarchy extend ActiveSupport::Concern module ClassMethods def cti_base_class? !!@cti_base_class end def cti_derived_class? !!@cti_derived_class end ...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/model/cti/destroy.rb
Ruby
mit
45
master
962
module DBViewCTI module Model module CTI module Destroy extend ActiveSupport::Concern # change destroy and delete methods to operate on most specialized object included do alias_method :destroy_without_cti, :destroy alias_method :destroy, :destroy_with_cti ...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/model/cti/association_validations.rb
Ruby
mit
45
master
2,637
module DBViewCTI module Model module CTI module AssociationValidations extend ActiveSupport::Concern included do # validations validate :cti_validate_associations, :cti_no_disable => true attr_accessor :cti_disable_validations end def c...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/model/cti/type_conversion.rb
Ruby
mit
45
master
2,041
module DBViewCTI module Model module CTI module TypeConversion def specialize class_name, id = type(true) return self if class_name == self.class.name class_name.constantize.find(id) end # Return the 'true' (i.e. most specialized) classname of ...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/model/cti/associations.rb
Ruby
mit
45
master
9,451
module DBViewCTI module Model module CTI module Associations extend ActiveSupport::Concern included do # for associations: # alias_method_chain :association, :cti alias_method :association_without_cti, :association alias_method :association, :associat...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/model/cti/sql.rb
Ruby
mit
45
master
627
module DBViewCTI module Model module CTI module SQL extend ActiveSupport::Concern module ClassMethods include DBViewCTI::SQLGeneration::Model # this method is only used in testing. It returns the number of rows present in the real database # table, ...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/sql_generation/model.rb
Ruby
mit
45
master
2,729
module DBViewCTI module SQLGeneration module Model # generates left-outer-join query used in specialize and type def cti_outer_join_sql(id) if !@cti_outer_join_query.nil? return [@cti_outer_join_query + "#{id if id}", @cti_outer_join_levels] end start = "SELECT #{DBVi...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/sql_generation/migration/postgresql.rb
Ruby
mit
45
master
4,180
module DBViewCTI module SQLGeneration module Migration class PostgreSQL < Base def create_trigger_sql # trigger function @trigger_func_name = DBViewCTI::Names.trigger_function_name(@derived_class) insert_trigger_func = <<-eos CREATE OR REPLA...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/sql_generation/migration/factory.rb
Ruby
mit
45
master
730
module DBViewCTI module SQLGeneration module Migration class Factory def self.generator(class_name, options = {}) adapter_type = if Rails::VERSION::MAJOR > 6 || ( Rails::VERSION::MAJOR == 6 && Rails::VERSION::MINOR >= 1) ActiveRecord::Base.configurations.configs_for(en...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/sql_generation/migration/base.rb
Ruby
mit
45
master
4,064
module DBViewCTI module SQLGeneration module Migration class Base def initialize(class_name, options = {}) @options = options @derived_class = class_name.constantize @base_class = @derived_class.superclass @base_class_table = @base_class.table_n...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
lib/db_view_cti/connection_adapters/schema_statements.rb
Ruby
mit
45
master
2,435
module DBViewCTI module ConnectionAdapters module SchemaStatements def cti_create_view(class_name, options = {}) generator = DBViewCTI::SQLGeneration::Migration::Factory.generator(class_name) cti_execute_sql(generator.create_view_sql) cti_execute_sql(generator.create_trigger_sql) ...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
spec/spec_helper.rb
Ruby
mit
45
master
2,019
# This file is copied to spec/ when you run 'rails generate rspec:install' ENV["RAILS_ENV"] ||= 'test' rails_major_version = 3 rails_major_version = ENV["RAILS_VERSION"][0] unless ENV["RAILS_VERSION"].nil? require File.expand_path("../dummy-rails-#{rails_major_version}/config/environment", __FILE__) require 'rspec/rai...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
spec/dummy-rails-6/db/migrate/20130817014120_create_space_shuttles.rb
Ruby
mit
45
master
346
require_relative './migration_helper' class CreateSpaceShuttles < MigrationHelper.migration_base_class def change create_table :space_shuttles do |t| t.references :space_ship t.integer :power t.timestamps end add_foreign_key(:space_shuttles, :space_ships) cti_create_view('Spac...
github
mvdamme/dbview_cti
https://github.com/mvdamme/dbview_cti
spec/dummy-rails-6/db/migrate/20131022020536_create_astronauts.rb
Ruby
mit
45
master
209
require_relative './migration_helper' class CreateAstronauts < MigrationHelper.migration_base_class def change create_table :astronauts do |t| t.string :name t.timestamps end end end