Skip to content

Ruby25 Compatibility. #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/xml/rexml_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ def each_on_axis(axis, &block)
# temporarily suppress warnings
class <<Kernel
alias_method :old_warn, :warn
def warn(*args)
if RUBY_VERSION >= '2.5.0' # REXML uses additional hash parameters in ruby 2.5 and onwards
Copy link
Owner

@multi-io multi-io Jan 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the if-else here? def warn(msg, **options) should be fully compatible with pre-2.5 REXML even if it doesn't pass any options, afaics.

def warn(msg, **options)
end
else
def warn(msg)
end
end
end
begin
Expand Down
32 changes: 32 additions & 0 deletions xml-mapping.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
$:.push File.expand_path('../lib', __FILE__)
require 'xml/mapping/version'

FILE_RDOC_MAIN = 'user_manual.md'.freeze
FILES_RDOC_EXTRA = [FILE_RDOC_MAIN] + %w{README.md user_manual_xxpath.md TODO.txt doc/xpath_impl_notes.txt}
FILES_RDOC_INCLUDES = `git ls-files examples`.split("\n").map{|f| f.gsub(/.intin.rb$/, '.intout')}

Gem::Specification.new do |config|
config.name = 'xml-mapping'
config.version = XML::Mapping::VERSION
config.authors = ['Olaf Klischat']
config.email = '[email protected]'
config.homepage = 'https://github.com/multi-io/xml-mapping'
config.summary = 'XML-Object mapper for Ruby'
config.description = 'An easy to use, extensible library for semi-automatically mapping Ruby objects to XML and back. Includes an XPath interpreter.'

config.rubyforge_project = 'xml-mapping'
config.platform = Gem::Platform::RUBY
config.licenses = ['Apache-2.0']


config.files += FILES_RDOC_EXTRA
config.files += FILES_RDOC_INCLUDES
config.files += `git ls-files lib test`.split("\n")
config.files += %w{LICENSE Rakefile}
config.test_file = 'test/all_tests.rb'
config.require_path = 'lib'
config.extra_rdoc_files = FILES_RDOC_EXTRA
config.rdoc_options += %w{--include examples}

config.add_development_dependency 'rake', '~> 0'
end