repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/struct_packed_spec.rb | spec/ffi/struct_packed_spec.rb | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
describe FFI::Struct do
it "packed :char followed by :int should have size of 5" do
expect(Class.new(FFI::Struct) do
packed
layout :c, :char, :i, :int
... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/dynamic_library_spec.rb | spec/ffi/dynamic_library_spec.rb | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
describe FFI::DynamicLibrary do
it "should be shareable for Ractor", :ractor do
libtest = FFI::DynamicLibrary.open(TestLibrary::PATH,
FFI::DynamicLibrary::RT... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/pointer_spec.rb | spec/ffi/pointer_spec.rb | # -*- encoding: utf-8 -*-
#
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
require 'delegate'
module PointerTestLib
extend FFI::Library
ffi_lib TestLibrary::PATH
begin
attach_function :ptr_ret_int32_t, [ :point... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/io_spec.rb | spec/ffi/io_spec.rb | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
if false # disabled for #390
describe "FFI::IO.for_fd" do
it "produces an IO wrapping the specified file descriptor" do
expect do
FFI::IO.for_fd(2, "r"... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/custom_param_type.rb | spec/ffi/custom_param_type.rb | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
describe "functions with custom parameter types" do
before :each do
Custom_enum = Class.new do
extend FFI::DataConverter
ToNativeMap= { :a => 1, :b => 2... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/errno_spec.rb | spec/ffi/errno_spec.rb | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
module ErrnoSpec
describe "FFI.errno" do
module LibTest
extend FFI::Library
ffi_lib TestLibrary::PATH
attach_function :setLastError, [ :int ], :void
atta... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/callback_spec.rb | spec/ffi/callback_spec.rb | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
module CallbackSpecs
describe "Callback" do
# module LibC
# extend FFI::Library
# callback :qsort_cmp, [ :pointer, :pointer ], :int
# attach_function :... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/bool_spec.rb | spec/ffi/bool_spec.rb | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
module BoolSpec
describe "Function with primitive boolean arguments and return values" do
module LibTest
extend FFI::Library
ffi_lib TestLibrary::PATH
attach... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/memorypointer_spec.rb | spec/ffi/memorypointer_spec.rb | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
MemoryPointer = FFI::MemoryPointer
describe "MemoryPointer#total" do
it "MemoryPointer.new(:char, 1).total == 1" do
expect(MemoryPointer.new(:char, 1).total).to eq ... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/custom_type_spec.rb | spec/ffi/custom_type_spec.rb | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
describe "functions with custom types" do
class Custom_enum
extend FFI::DataConverter
ToNativeMap= { :a => 1, :b => 2, :c => 3 }
FromNativeMap = { 1 => :a, 2... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/spec_helper.rb | spec/ffi/spec_helper.rb | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require_relative 'fixtures/compile'
require 'timeout'
require 'objspace'
if defined? Ractor
class Ractor
# compat with Ruby-3.4 and older
alias value take unless method_defined? :value
end
end
RSpec.configure do |c|
c.filter_run_ex... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/platform_spec.rb | spec/ffi/platform_spec.rb | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
describe "FFI::Platform::LIBSUFFIX" do
case TestLibrary::OS
when "linux"
it "returns 'so'" do
expect(FFI::Platform::LIBSUFFIX).to eq('so')
end
when "wi... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/struct_by_ref_spec.rb | spec/ffi/struct_by_ref_spec.rb | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
describe FFI::Struct, ' by_ref' do
before :all do
@struct_class = struct_class = Class.new(FFI::Struct) do
layout :a, :pointer
end
@api = Module.new d... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/embed-test/embed-test.rb | spec/ffi/embed-test/embed-test.rb | #!/usr/bin/env ruby
#
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
# This test specifically avoids calling native code through FFI.
# Instead, the stock extension mechanism is used. The reason is
# that the C extension initializes FFI and then calls a callback
# which deadlocked in earlier FFI... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/embed-test/ext/extconf.rb | spec/ffi/embed-test/ext/extconf.rb | #!/usr/bin/env ruby
#
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
if RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
require "mkmf"
create_makefile("embed_test")
end
| ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/fixtures/compile.rb | spec/ffi/fixtures/compile.rb | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require 'rbconfig'
require 'fileutils'
require 'ffi'
module TestLibrary
CPU = case RbConfig::CONFIG['host_cpu'].downcase
when /i[3456]86/
# Darwin always reports i686, even when running in 64bit mode
if RbConfig::CONFIG['host_os... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/rbx/memory_pointer_spec.rb | spec/ffi/rbx/memory_pointer_spec.rb | # coding: utf-8
#
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
describe "MemoryPointer" do
it "makes a pointer from a string" do
m = FFI::MemoryPointer.from_string("FFI is Awesome")
expect(m.total).to eq(15)
... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/rbx/struct_spec.rb | spec/ffi/rbx/struct_spec.rb | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
module RbxStructSpecs
class Timeval < FFI::Struct
layout :tv_sec, :ulong, 0, :tv_usec, :ulong, 4
end
describe FFI::Struct do
it "allows setting fields" do
... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/rbx/attach_function_spec.rb | spec/ffi/rbx/attach_function_spec.rb | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
module RbxAttachFunctionSpecs
class Timeval < FFI::Struct
layout :tv_sec, :ulong, 0, :tv_usec, :ulong, 4
end
module LibC
extend FFI::Library
if FFI::Pla... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/spec/ffi/rbx/spec_helper.rb | spec/ffi/rbx/spec_helper.rb | #
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "../spec_helper"))
| ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi.rb | lib/ffi.rb | if RUBY_ENGINE == 'ruby'
begin
require RUBY_VERSION.split('.')[0, 2].join('.') + '/ffi_c'
rescue Exception
require 'ffi_c'
end
require 'ffi/ffi'
elsif RUBY_ENGINE == 'jruby' && (RUBY_ENGINE_VERSION.split('.').map(&:to_i) <=> [9, 2, 20]) >= 0
JRuby::Util.load_ext("org.jruby.ext.ffi.FFIService")
req... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/platform.rb | lib/ffi/platform.rb | #
# Copyright (C) 2008, 2009 Wayne Meissner
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyrigh... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/io.rb | lib/ffi/io.rb | #
# Copyright (C) 2008, 2009 Wayne Meissner
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyrigh... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/callback.rb | lib/ffi/callback.rb | #
# All the code from this file is now implemented in C. This file remains
# to satisfy any leftover require 'ffi/callback' in user code
#
| ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/errno.rb | lib/ffi/errno.rb | #
# Copyright (C) 2008-2010 Wayne Meissner
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/library.rb | lib/ffi/library.rb | #
# Copyright (C) 2008-2010 Wayne Meissner
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/version.rb | lib/ffi/version.rb | module FFI
VERSION = '1.17.3'
end
| ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/autopointer.rb | lib/ffi/autopointer.rb | #
# Copyright (C) 2008-2010 Wayne Meissner
# Copyright (C) 2008 Mike Dalessio
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source c... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/struct.rb | lib/ffi/struct.rb | #
# Copyright (C) 2008-2010 Wayne Meissner
# Copyright (C) 2008, 2009 Andrea Fazzi
# Copyright (C) 2008, 2009 Luc Heinrich
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/struct_layout_builder.rb | lib/ffi/struct_layout_builder.rb | #
# Copyright (C) 2008-2010 Wayne Meissner
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/struct_by_reference.rb | lib/ffi/struct_by_reference.rb | #
# Copyright (C) 2010 Wayne Meissner
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright noti... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/struct_layout.rb | lib/ffi/struct_layout.rb | #
# Copyright (C) 2008-2010 Wayne Meissner
# Copyright (C) 2008, 2009 Andrea Fazzi
# Copyright (C) 2008, 2009 Luc Heinrich
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/compat.rb | lib/ffi/compat.rb | #
# Copyright (C) 2023-2023 Lars Kanis
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright not... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/data_converter.rb | lib/ffi/data_converter.rb | #
# Copyright (C) 2008-2010 Wayne Meissner
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/library_path.rb | lib/ffi/library_path.rb | #
# Copyright (C) 2023 Lars Kanis
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, ... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/pointer.rb | lib/ffi/pointer.rb | #
# Copyright (C) 2008, 2009 Wayne Meissner
# Copyright (c) 2007, 2008 Evan Phoenix
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of so... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/union.rb | lib/ffi/union.rb | #
# Copyright (C) 2009 Andrea Fazzi <andrea.fazzi@alcacoop.it>
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/ffi.rb | lib/ffi/ffi.rb | #
# Copyright (C) 2008-2010 JRuby project
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright ... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/types.rb | lib/ffi/types.rb | #
# Copyright (C) 2008-2010 Wayne Meissner
# Copyright (c) 2007, 2008 Evan Phoenix
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sou... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/enum.rb | lib/ffi/enum.rb | #
# Copyright (C) 2009, 2010 Wayne Meissner
# Copyright (C) 2009 Luc Heinrich
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source c... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/memorypointer.rb | lib/ffi/memorypointer.rb | # This class is now implemented in C
| ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/function.rb | lib/ffi/function.rb | #
# Copyright (C) 2008-2010 JRuby project
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright ... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/variadic.rb | lib/ffi/variadic.rb | #
# Copyright (C) 2008, 2009 Wayne Meissner
# Copyright (C) 2009 Luc Heinrich
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source c... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/abstract_memory.rb | lib/ffi/abstract_memory.rb | #
# Copyright (C) 2020 Lars Kanis
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, ... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/buffer.rb | lib/ffi/buffer.rb | #
# All the code from this file is now implemented in C. This file remains
# to satisfy any leftover require 'ffi/buffer' in user code
#
| ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/dynamic_library.rb | lib/ffi/dynamic_library.rb | #
# Copyright (C) 2008-2010 Wayne Meissner
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/managedstruct.rb | lib/ffi/managedstruct.rb | # Copyright (C) 2008 Mike Dalessio
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/tools/struct_generator.rb | lib/ffi/tools/struct_generator.rb | require 'tempfile'
module FFI
##
# Generates an FFI Struct layout.
#
# Given the @@@ portion in:
#
# class Zlib::ZStream < FFI::Struct
# @@@
# name "struct z_stream_s"
# include "zlib.h"
#
# field :next_in, :pointer
# field :avail_in, :uint
# field :total_in, :u... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/tools/const_generator.rb | lib/ffi/tools/const_generator.rb | require 'tempfile'
require 'open3'
module FFI
# ConstGenerator turns C constants into ruby values.
#
# @example a simple example for stdio
# require 'ffi/tools/const_generator'
# cg = FFI::ConstGenerator.new('stdio') do |gen|
# gen.const(:SEEK_SET)
# gen.const('SEEK_CUR')
# gen.const('seek_... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/tools/generator.rb | lib/ffi/tools/generator.rb | require 'ffi/tools/struct_generator'
require 'ffi/tools/const_generator'
module FFI
##
# Generate files with C structs for FFI::Struct and C constants.
#
# == A simple example
#
# In file +zlib.rb.ffi+:
# module Zlib
# @@@
# constants do |c|
# c.include "zlib.h"
# c.const :... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
ffi/ffi | https://github.com/ffi/ffi/blob/88f34306f5be615d61e780f931554dc8109252ca/lib/ffi/tools/generator_task.rb | lib/ffi/tools/generator_task.rb | require 'ffi/tools/generator'
require 'rake'
require 'rake/tasklib'
##
# Add Rake tasks that generate files with C structs for FFI::Struct and C constants.
#
# @example a simple example for your Rakefile
# require "ffi/tools/generator_task"
# # Add a task to generate my_object.rb out of my_object.rb.ffi
# FFI::G... | ruby | BSD-3-Clause | 88f34306f5be615d61e780f931554dc8109252ca | 2026-01-04T15:58:11.213459Z | false |
mislav/git-deploy | https://github.com/mislav/git-deploy/blob/744f4c02a356338228e40dc7aa1923c3efda4209/spec/configuration_spec.rb | spec/configuration_spec.rb | require 'rspec/autorun'
require 'git_deploy/configuration'
describe GitDeploy::Configuration do
subject {
mod = described_class
obj = Object.new
opt = options
(class << obj; self; end).class_eval do
include mod
mod.private_instance_methods.each {|m| public m }
define_method(:option... | ruby | MIT | 744f4c02a356338228e40dc7aa1923c3efda4209 | 2026-01-04T15:58:25.358725Z | false |
mislav/git-deploy | https://github.com/mislav/git-deploy/blob/744f4c02a356338228e40dc7aa1923c3efda4209/lib/git_deploy.rb | lib/git_deploy.rb | require 'thor'
require 'net/ssh'
require 'net/scp'
class GitDeploy < Thor
LOCAL_DIR = File.expand_path('..', __FILE__)
require 'git_deploy/configuration'
require 'git_deploy/ssh_methods'
include Configuration
include SSHMethods
class_option :remote, :aliases => '-r', :type => :string, :default => 'origin... | ruby | MIT | 744f4c02a356338228e40dc7aa1923c3efda4209 | 2026-01-04T15:58:25.358725Z | false |
mislav/git-deploy | https://github.com/mislav/git-deploy/blob/744f4c02a356338228e40dc7aa1923c3efda4209/lib/git_deploy/ssh_methods.rb | lib/git_deploy/ssh_methods.rb | class GitDeploy
module SSHMethods
private
def sudo_cmd
"sudo -p 'sudo password: '"
end
def system(*args)
puts "[local] $ " + args.join(' ').gsub(' && ', " && \\\n ")
super unless options.noop?
end
def run(cmd = nil, opt = {})
cmd = yield(cmd) if block_given?
c... | ruby | MIT | 744f4c02a356338228e40dc7aa1923c3efda4209 | 2026-01-04T15:58:25.358725Z | false |
mislav/git-deploy | https://github.com/mislav/git-deploy/blob/744f4c02a356338228e40dc7aa1923c3efda4209/lib/git_deploy/configuration.rb | lib/git_deploy/configuration.rb | require 'uri'
require 'cgi'
require 'forwardable'
class GitDeploy
module Configuration
private
extend Forwardable
def_delegator :remote_url, :host
def_delegator :remote_url, :port, :remote_port
def deploy_to
@deploy_to ||= begin
if remote_url.path.start_with? '/~/'
remot... | ruby | MIT | 744f4c02a356338228e40dc7aa1923c3efda4209 | 2026-01-04T15:58:25.358725Z | false |
mislav/git-deploy | https://github.com/mislav/git-deploy/blob/744f4c02a356338228e40dc7aa1923c3efda4209/lib/git_deploy/generator.rb | lib/git_deploy/generator.rb | require 'thor/group'
class GitDeploy::Generator < Thor::Group
include Thor::Actions
def self.source_root
File.expand_path('../templates', __FILE__)
end
def copy_main_hook
copy_hook 'after_push.sh', 'deploy/after_push'
end
def copy_restart_hook
copy_hook 'restart.sh', 'deploy/restart'
end
... | ruby | MIT | 744f4c02a356338228e40dc7aa1923c3efda4209 | 2026-01-04T15:58:25.358725Z | false |
mislav/git-deploy | https://github.com/mislav/git-deploy/blob/744f4c02a356338228e40dc7aa1923c3efda4209/lib/git_deploy/templates/before_restart.rb | lib/git_deploy/templates/before_restart.rb | #!/usr/bin/env ruby
oldrev, newrev = ARGV
def run(cmd)
exit($?.exitstatus) unless system "umask 002 && #{cmd}"
end
RAILS_ENV = ENV['RAILS_ENV'] || 'production'
use_bundler = File.file? 'Gemfile'
rake_cmd = use_bundler ? 'bundle exec rake' : 'rake'
if use_bundler
bundler_args = ['--deployment']
BUNDLE_WITH... | ruby | MIT | 744f4c02a356338228e40dc7aa1923c3efda4209 | 2026-01-04T15:58:25.358725Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require "bundler"
require "byebug"
Bundler.setup(:default, :development)
unless RUBY_PLATFORM =~ /java/
require "simplecov"
SimpleCov.start do
add_filter "spec"
end
end
require "savon"
require "rspec"
support_files = File.expand_path("spec/support/**/*.rb")
Dir[support_files... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/support/stdout.rb | spec/support/stdout.rb | # frozen_string_literal: true
module SpecSupport
def mock_stdout
original_stdout = $stdout
stdout = StringIO.new
$stdout = stdout
yield
$stdout = original_stdout
stdout
end
def silence_stdout
original_stdout = $stdout
$stdout = StringIO.new
result = yield
$stdout = o... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/support/responses.rb | spec/support/responses.rb | class Responses
class << self
def mock_faraday(code, headers, body)
env = Faraday::Env.from(status: code, response_headers: headers, response_body: body)
Faraday::Response.new(env)
end
end
end | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/support/fixture.rb | spec/support/fixture.rb | # frozen_string_literal: true
class Fixture
TYPES = { :gzip => "gz", :response => "xml", :wsdl => "xml" }
class << self
def [](type, fixture)
fixtures(type)[fixture] ||= read_file type, fixture
end
def full_hash(fixture)
@full_hash ||= {}
@full_hash[fixture] ||= nori.parse(response... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/support/integration.rb | spec/support/integration.rb | # frozen_string_literal: true
module SpecSupport
def call_and_fail_gracefully(client, *args, &block)
client.call(*args, &block)
rescue Savon::SOAPFault => e
puts e.message
end
end
| ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/support/endpoint.rb | spec/support/endpoint.rb | # frozen_string_literal: true
class Endpoint
class << self
# Returns the WSDL endpoint for a given +type+ of request.
def wsdl(type = nil)
case type
when :no_namespace then "http://nons.example.com/Service?wsdl"
when :namespaced_actions then "http://nsactions.example.com/Service?w... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/integration/zipcode_example_spec.rb | spec/integration/zipcode_example_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe "ZIP code example" do
let(:expected) { ["seventy million seventy thousand ten ", "twenty four million fifty thousand one hundred and ten ", "twenty million fifty thousand five hundred and fifty "] }
let(:request_data) { [70070010, 24050110, 2005055... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/integration/support/application.rb | spec/integration/support/application.rb | # frozen_string_literal: true
require "rack"
require "json"
class IntegrationServer
def self.respond_with(options = {})
code = options.fetch(:code, 200)
body = options.fetch(:body, "")
headers = { "Content-Type" => "text/plain", "Content-Length" => body.size.to_s }.merge options.fetch(:headers, {})
... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/integration/support/server.rb | spec/integration/support/server.rb | # frozen_string_literal: true
require "puma"
require "puma/minissl"
require "integration/support/application"
class IntegrationServer
def self.run(options = {})
server = new(options)
server.run
server
end
def self.ssl_ca_file; integration_fixture("ca_all.pem") end
def self.ssl_key_file; inte... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/log_message_spec.rb | spec/savon/log_message_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Savon::LogMessage do
it "returns the message if it's not XML" do
message = log_message("hello", [:password], :pretty_print).to_s
expect(message).to eq("hello")
end
it "returns the message if it shouldn't be filtered or pretty printed" d... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/mock_spec.rb | spec/savon/mock_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "savon/mock/spec_helper"
RSpec.describe "Savon's mock interface" do
include Savon::SpecHelper
before :all do
savon.mock!
end
after :all do
savon.unmock!
end
it "can verify a request and return a fixture response" do
message = { :use... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/operation_spec.rb | spec/savon/operation_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "integration/support/server"
require "json"
require "ostruct"
RSpec.describe Savon::Operation do
let(:globals) { Savon::GlobalOptions.new(:endpoint => @server.url(:repeat), :log => false) }
let(:wsdl) { Wasabi::Document.new Fixture.wsdl(:taxcloud) }
... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/response_spec.rb | spec/savon/response_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Savon::Response do
let(:globals) { Savon::GlobalOptions.new }
let(:locals) { Savon::LocalOptions.new }
describe ".new" do
it "should raise a Savon::Fault in case of a SOAP fault" do
expect { soap_fault_response }.to raise_error(Savon... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/http_error_spec.rb | spec/savon/http_error_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Savon::HTTPError do
let(:http_error) { Savon::HTTPError.new new_response(:code => 404, :body => "Not Found") }
let(:http_error_with_empty_body) { Savon::HTTPError.new new_response(:code => 404, :body => "") }
let(:no_error) { Savon::HTTPError.new... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/request_spec.rb | spec/savon/request_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "integration/support/server"
RSpec.describe Savon::WSDLRequest do
let(:globals) { Savon::GlobalOptions.new }
let(:http_connection) { Faraday::Connection.new }
let(:ciphers) { OpenSSL::Cipher.ciphers }
def new_wsdl_request
Savon::WSDLRe... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/client_spec.rb | spec/savon/client_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "integration/support/server"
RSpec.describe Savon::Client do
before :all do
@server = IntegrationServer.run
end
after :all do
@server.stop
end
describe ".new" do
it "supports a block without arguments to create a client with global op... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/multipart_request_spec.rb | spec/savon/multipart_request_spec.rb | require "spec_helper"
RSpec.describe Savon::Builder do
let(:globals) { Savon::GlobalOptions.new({ :endpoint => "http://example.co", :namespace => "http://v1.example.com" }) }
let(:no_wsdl) { Wasabi::Document.new }
it "building multipart request from inline content" do
locals = {
attachments: ... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/string_utils_spec.rb | spec/savon/string_utils_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Savon::StringUtils do
describe "snakecase" do
it "lowercases one word CamelCase" do
expect(Savon::StringUtils.snakecase("Merb")).to eq("merb")
end
it "makes one underscore snakecase two word CamelCase" do
expect(Savon::Strin... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/softlayer_spec.rb | spec/savon/softlayer_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Savon::Builder do
subject(:builder) { Savon::Builder.new(:create_object, wsdl, globals, locals) }
let(:globals) { Savon::GlobalOptions.new }
# let(:locals) { Savon::LocalOptions.new }
let(:wsdl) { Wasabi::Document.new Fixture.... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/message_spec.rb | spec/savon/message_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "integration/support/server"
RSpec.describe Savon::Message do
before do
@server = IntegrationServer.run
end
after do
@server.stop
end
let(:client_config) {
{
:endpoint => @server.url(:repeat),
:namespace => 'http://example... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/request_logger_spec.rb | spec/savon/request_logger_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Savon::RequestLogger do
subject { described_class.new(globals) }
let(:globals) { Savon::GlobalOptions.new(:log => true, :pretty_print_xml => true) }
let(:request) {
stub('Request',
:url => 'http://example.com',
... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/model_spec.rb | spec/savon/model_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "integration/support/server"
RSpec.describe Savon::Model do
before :all do
@server = IntegrationServer.run
end
after :all do
@server.stop
end
describe ".client" do
it "returns the memoized client" do
model = Class.new {
... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/soap_fault_spec.rb | spec/savon/soap_fault_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Savon::SOAPFault do
let(:soap_fault) { Savon::SOAPFault.new new_response(:body => Fixture.response(:soap_fault)), nori }
let(:empty_soap_fault) { Savon::SOAPFault.new new_response(:body => Fixture.response(:empty_soap_fault)), nori }
let(:soap_fa... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/observers_spec.rb | spec/savon/observers_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "integration/support/server"
RSpec.describe Savon do
before :all do
@server = IntegrationServer.run
end
after :all do
@server.stop
end
describe ".observers" do
after :each do
Savon.observers.clear
end
it "allows to regi... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/builder_spec.rb | spec/savon/builder_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Savon::Builder do
subject(:builder) { Savon::Builder.new(:authenticate, wsdl, globals, locals) }
let(:globals) { Savon::GlobalOptions.new }
let(:locals) { Savon::LocalOptions.new }
let(:wsdl) { Wasabi::Document.new Fixture.wsd... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/qualified_message_spec.rb | spec/savon/qualified_message_spec.rb | # frozen_string_literal: true
require "spec_helper"
module Savon
RSpec.describe QualifiedMessage, "#to_hash" do
context "if a key ends with !" do
let(:used_namespaces) { {} }
let(:key_converter) { :camelcase }
let(:types) { {} }
it "restores the ! in a key" do
message = describe... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/options_spec.rb | spec/savon/options_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "integration/support/server"
require "json"
require "ostruct"
require "logger"
RSpec.describe "Options" do
shared_examples(:deprecation) do |option|
it "Raises a deprecation error" do
expect { new_client(:endpoint => @server.url, option => :none)... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | true |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/spec/savon/features/message_tag_spec.rb | spec/savon/features/message_tag_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Savon do
it 'knows the message tag for :authentication' do
message_tag = message_tag_for(:authentication, :authenticate)
expect(message_tag).to eq(['http://v1_0.ws.auth.order.example.com/', 'authenticate'])
end
it 'knows the message tag... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/lib/savon.rb | lib/savon.rb | # frozen_string_literal: true
module Savon
Error = Class.new(RuntimeError)
InitializationError = Class.new(Error)
UnknownOptionError = Class.new(Error)
UnknownOperationError = Class.new(Error)
InvalidResponseError = Class.new(Error)
class DeprecatedOptionError < Error
attr_access... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/lib/savon/version.rb | lib/savon/version.rb | # frozen_string_literal: true
module Savon
VERSION = '3.0.0.rc2'
end
| ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/lib/savon/qualified_message.rb | lib/savon/qualified_message.rb | # frozen_string_literal: true
require "gyoku"
module Savon
class QualifiedMessage
def initialize(types, used_namespaces, key_converter)
@types = types
@used_namespaces = used_namespaces
@key_converter = key_converter
end
def to_hash(hash, path)
return hash unless hash... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/lib/savon/options.rb | lib/savon/options.rb | # frozen_string_literal: true
require "logger"
module Savon
class Options
def initialize(options = {})
@options = {}
assign options
end
def deprecate(option)
raise DeprecatedOptionError.new(option)
end
attr_reader :option_type
def [](option)
@options[option]
en... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/lib/savon/soap_fault.rb | lib/savon/soap_fault.rb | # frozen_string_literal: true
module Savon
class SOAPFault < Error
def self.present?(http, xml = nil)
xml_orig ||= http.body
if xml_orig.valid_encoding?
xml = xml_orig
else
xml = xml_orig.encode(
'UTF-8', "ISO-8859-1", invalid: :replace, undef: :replace, replace: ''
... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/lib/savon/response.rb | lib/savon/response.rb | # frozen_string_literal: true
require "nori"
require "savon/soap_fault"
require "savon/http_error"
module Savon
class Response
CRLF = /\r\n/
WSP = /[#{%Q|\x9\x20|}]/
def initialize(http, globals, locals)
@http = http
@globals = globals
@locals = locals
@attachments = []
... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/lib/savon/string_utils.rb | lib/savon/string_utils.rb | # frozen_string_literal: true
module Savon
module StringUtils
def self.snakecase(inputstring)
str = inputstring.dup
str.gsub! /::/, '/'
str.gsub! /([A-Z]+)([A-Z][a-z])/, '\1_\2'
str.gsub! /([a-z\d])([A-Z])/, '\1_\2'
str.tr! ".", "_"
str.tr! "-", "_"
str.downcase!
s... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/lib/savon/http_error.rb | lib/savon/http_error.rb | # frozen_string_literal: true
module Savon
class HTTPError < Error
def self.present?(http)
!http.success?
end
def initialize(http)
@http = http
end
attr_reader :http
def to_s
String.new("HTTP error (#{@http.status})").tap do |str_error|
str_error << ": #{@http.bo... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/lib/savon/request_logger.rb | lib/savon/request_logger.rb | # frozen_string_literal: true
require "savon/log_message"
module Savon
class RequestLogger
def initialize(globals)
@globals = globals
end
def log(request, &http_request)
log_request(request) if log?
response = http_request.call
log_response(response) if log?
response
... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/lib/savon/message.rb | lib/savon/message.rb | # frozen_string_literal: true
require "savon/qualified_message"
require "gyoku"
module Savon
class Message
def initialize(message_tag, namespace_identifier, types, used_namespaces, message, element_form_default, key_converter, unwrap)
@message_tag = message_tag
@namespace_identifier = namespace_iden... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/lib/savon/client.rb | lib/savon/client.rb | # frozen_string_literal: true
require "savon/operation"
require "savon/request"
require "savon/options"
require "savon/block_interface"
require "wasabi"
module Savon
class Client
def initialize(globals = {}, &block)
unless globals.kind_of? Hash
raise_version1_initialize_error! globals
end
... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/lib/savon/request.rb | lib/savon/request.rb | # frozen_string_literal: true
require "faraday"
module Savon
class HTTPRequest
def initialize(globals, connection = nil)
@globals = globals
@connection = connection || Faraday::Connection.new
end
private
def configure_proxy
connection.proxy = @globals[:proxy] if @globals.include?... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/lib/savon/block_interface.rb | lib/savon/block_interface.rb | # frozen_string_literal: true
module Savon
class BlockInterface
def initialize(target)
@target = target
end
def evaluate(block)
if block.arity > 0
block.call(@target)
else
@original = eval("self", block.binding)
instance_eval(&block)
end
end
priva... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/lib/savon/builder.rb | lib/savon/builder.rb | # frozen_string_literal: true
require "savon/header"
require "savon/message"
require "nokogiri"
require "builder"
require "gyoku"
module Savon
class Builder
attr_reader :multipart
SCHEMA_TYPES = {
"xmlns:xsd" => "http://www.w3.org/2001/XMLSchema",
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
savonrb/savon | https://github.com/savonrb/savon/blob/04491c318cbc2d9971a2e203a6dd691cf20113bf/lib/savon/log_message.rb | lib/savon/log_message.rb | # frozen_string_literal: true
require "nokogiri"
module Savon
class LogMessage
def initialize(message, filters = [], pretty_print = false)
@message = message
@filters = filters
@pretty_print = pretty_print
end
def to_s
message_is_xml = @message =~ /^</
has_filter... | ruby | MIT | 04491c318cbc2d9971a2e203a6dd691cf20113bf | 2026-01-04T15:58:29.091841Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.