Skip to content

Commit

Permalink
Finish 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Dec 16, 2019
2 parents 2c5a106 + ef49037 commit f902338
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 50 deletions.
15 changes: 5 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
language: ruby
bundler_args: --without debug
script: "bundle exec rspec spec"
before_install:
- 'gem update --system --conservative || (gem i "rubygems-update:~>2.7" --no-document && update_rubygems)'
- 'gem update bundler --conservative'
env:
- CI=true
rvm:
- 2.2.2
- 2.3
- 2.4
- 2.5
- 2.6
- jruby-9
- rbx-3
- 2.7
- jruby
- rbx
cache: bundler
sudo: false
matrix:
allow_failures:
- rvm: jruby-9
- rvm: rbx-3
- rvm: jruby
- rvm: rbx
dist: trusty
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This is a Ruby implementation of a universal [S-expression][] parser.
* Parses S-expressions in universal, [Scheme][], [Common Lisp][], or
[SPARQL][] syntax.
* Adds a `#to_sxp` method to Ruby objects.
* Compatible with Ruby >= 2.2.2, Rubinius >= 3.0, and JRuby 9+.
* Compatible with Ruby >= 2.4, Rubinius >= 3.0, and JRuby 9+.

## Examples

Expand Down Expand Up @@ -74,8 +74,8 @@ This is a Ruby implementation of a universal [S-expression][] parser.
Dependencies
------------

* [Ruby](http://ruby-lang.org/) (>= 2.2.2)
* [RDF.rb](http://rubygems.org/gems/rdf) (~> 3.0), only needed for SPARQL
* [Ruby](http://ruby-lang.org/) (>= 2.4)
* [RDF.rb](http://rubygems.org/gems/rdf) (~> 3.1), only needed for SPARQL
S-expressions

Installation
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.2
1.1.0
18 changes: 9 additions & 9 deletions lib/sxp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ module SXP
# @param [String, #to_s] url
# @param [Hash{Symbol => Object}] options
# @return [Enumerable<Object>]
def self.read_url(url, options = {})
Reader::Basic.read_url(url, options)
def self.read_url(url, **options)
Reader::Basic.read_url(url, **options)
end

##
Expand All @@ -42,7 +42,7 @@ def self.read_url(url, options = {})
# @overload read_files(*filenames)
# @param [Enumerable<String>] filenames
#
# @overload read_files(*filenames, options)
# @overload read_files(*filenames, **options)
# @param [Enumerable<String>] filenames
# @param [Hash{Symbol => Object}] options
#
Expand All @@ -57,8 +57,8 @@ def self.read_files(*filenames)
# @param [String, #to_s] filename
# @param [Hash{Symbol => Object}] options
# @return [Enumerable<Object>]
def self.read_file(filename, options = {})
Reader::Basic.read_file(filename, options)
def self.read_file(filename, **options)
Reader::Basic.read_file(filename, **options)
end

##
Expand All @@ -67,8 +67,8 @@ def self.read_file(filename, options = {})
# @param [IO, StringIO, String] input
# @param [Hash{Symbol => Object}] options
# @return [Enumerable<Object>]
def self.read_all(input, options = {})
Reader::Basic.read_all(input, options)
def self.read_all(input, **options)
Reader::Basic.read_all(input, **options)
end

##
Expand All @@ -77,8 +77,8 @@ def self.read_all(input, options = {})
# @param [IO, StringIO, String] input
# @param [Hash{Symbol => Object}] options
# @return [Object]
def self.read(input, options = {})
Reader::Basic.read(input, options)
def self.read(input, **options)
Reader::Basic.read(input, **options)
end

##
Expand Down
6 changes: 3 additions & 3 deletions lib/sxp/reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class EOF < Error; end
# @return [Enumerable<Object>]
def self.read_url(url, **options)
require 'open-uri'
open(url.to_s, 'rb', nil, **options) { |io| read_all(io, options) }
open(url.to_s, 'rb', nil, **options) { |io| read_all(io, **options) }
end

##
Expand All @@ -33,15 +33,15 @@ def self.read_url(url, **options)
# @overload read_files(*filenames)
# @param [Enumerable<String>] filenames
#
# @overload read_files(*filenames, options)
# @overload read_files(*filenames, **options)
# @param [Enumerable<String>] filenames
# @param [Hash{Symbol => Object}] options
# See {#read}
#
# @return [Enumerable<Object>]
def read_files(*filenames)
options = filenames.last.is_a?(Hash) ? filenames.pop : {}
filenames.map { |filename| read_file(filename, options) }.inject { |sxps, sxp| sxps + sxp }
filenames.map { |filename| read_file(filename, **options) }.inject { |sxps, sxp| sxps + sxp }
end

##
Expand Down
4 changes: 2 additions & 2 deletions lib/sxp/reader/common_lisp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class CommonLisp < Basic
# @option options [Object] :t (true)
# @option options [Object] :quote (:quote)
# @option options [Object] :function (:function)
def initialize(input, options = {}, &block)
super(input, OPTIONS.merge(options), &block)
def initialize(input, **options, &block)
super(input, **OPTIONS.merge(options), &block)
end

##
Expand Down
2 changes: 1 addition & 1 deletion lib/sxp/reader/sparql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def read_rdf_literal
{datatype: read_token.last}
else {}
end
RDF::Literal(value, options)
RDF::Literal(value, **options)
end

##
Expand Down
8 changes: 4 additions & 4 deletions spec/common_lisp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@
end
end

def read(input, options = {})
SXP::Reader::CommonLisp.new(input.freeze, options.freeze).read
def read(input, **options)
SXP::Reader::CommonLisp.new(input.freeze, **options.freeze).read
end

def read_all(input, options = {})
SXP::Reader::CommonLisp.new(input.freeze, options.freeze).read_all
def read_all(input, **options)
SXP::Reader::CommonLisp.new(input.freeze, **options.freeze).read_all
end
end
8 changes: 4 additions & 4 deletions spec/reader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@
expect(SXP.read_file("http://example/foo.sxp")).to eq [[1, 2, 3], [4, 5, 6]]
end

def read(input, options = {})
SXP::Reader::Basic.read(input.freeze, options)
def read(input, **options)
SXP::Reader::Basic.read(input.freeze, **options)
end

def read_all(input, options = {})
SXP::Reader::Basic.read_all(input.freeze, options)
def read_all(input, **options)
SXP::Reader::Basic.read_all(input.freeze, **options)
end
end
8 changes: 4 additions & 4 deletions spec/scheme_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@
end
end

def read(input, options = {})
SXP::Reader::Scheme.new(input.freeze, options.freeze).read
def read(input, **options)
SXP::Reader::Scheme.new(input.freeze, **options.freeze).read
end

def read_all(input, options = {})
SXP::Reader::Scheme.new(input.freeze, options.freeze).read_all
def read_all(input, **options)
SXP::Reader::Scheme.new(input.freeze, **options.freeze).read_all
end
end
8 changes: 4 additions & 4 deletions spec/sparql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,11 @@
end
end

def read(input, options = {})
SXP::Reader::SPARQL.new(input, options).read
def read(input, **options)
SXP::Reader::SPARQL.new(input, **options).read
end

def read_all(input, options = {})
SXP::Reader::SPARQL.new(input.freeze, options).read_all
def read_all(input, **options)
SXP::Reader::SPARQL.new(input.freeze, **options).read_all
end
end
9 changes: 4 additions & 5 deletions sxp.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Gem::Specification.new do |gem|
gem.license = 'Unlicense'
gem.summary = 'A pure-Ruby implementation of a universal S-expression parser.'
gem.description = 'Universal S-expression parser with specific support for Common Lisp, Scheme, and RDF/SPARQL'
gem.rubyforge_project = 'sxp'

gem.author = ['Arto Bendiken', 'Gregg Kellogg']
gem.email = ['[email protected]', '[email protected]']
Expand All @@ -21,11 +20,11 @@ Gem::Specification.new do |gem|
gem.executables = %w(sxp2rdf sxp2json sxp2xml sxp2yaml)
gem.require_paths = %w(lib)

gem.required_ruby_version = '>= 2.2.2'
gem.required_ruby_version = '>= 2.4'
gem.requirements = []
gem.add_development_dependency 'rspec', '~> 3.8'
gem.add_development_dependency 'yard' , '~> 0.9.18'
gem.add_runtime_dependency 'rdf', '~> 3.0'
gem.add_development_dependency 'rspec', '~> 3.9'
gem.add_development_dependency 'yard' , '~> 0.9.20'
gem.add_runtime_dependency 'rdf', '~> 3.1'

gem.post_install_message = nil
end

0 comments on commit f902338

Please sign in to comment.