diff --git a/.gemspec b/.gemspec deleted file mode 100644 index ea0db60..0000000 --- a/.gemspec +++ /dev/null @@ -1,307 +0,0 @@ -# encoding: utf-8 - -require 'yaml' -require 'pathname' - -module Indexer - - # Convert index data into a gemspec. - # - # Notes: - # * Assumes all executables are in bin/. - # * Does not yet handle default_executable setting. - # * Does not yet handle platform setting. - # * Does not yet handle required_ruby_version. - # * Support for rdoc entries is weak. - # - class GemspecExporter - - # File globs to include in package --unless a manifest file exists. - FILES = ".index .yardopts alt bin data demo ext features lib man spec test try* [A-Z]*.*" unless defined?(FILES) - - # File globs to omit from FILES. - OMIT = "Config.rb" unless defined?(OMIT) - - # Standard file patterns. - PATTERNS = { - :root => '{.index,Gemfile}', - :bin => 'bin/*', - :lib => 'lib/{**/}*', #.rb', - :ext => 'ext/{**/}extconf.rb', - :doc => '*.{txt,rdoc,md,markdown,tt,textile}', - :test => '{test,spec}/{**/}*.rb' - } unless defined?(PATTERNS) - - # For which revision of indexer spec is this converter intended? - REVISION = 2013 unless defined?(REVISION) - - # - def self.gemspec - new.to_gemspec - end - - # - attr :metadata - - # - def initialize(metadata=nil) - @root_check = false - - if metadata - root_dir = metadata.delete(:root) - if root_dir - @root = root_dir - @root_check = true - end - metadata = nil if metadata.empty? - end - - @metadata = metadata || YAML.load_file(root + '.index') - - if @metadata['revision'].to_i != REVISION - warn "This gemspec exporter was not designed for this revision of index metadata." - end - end - - # - def has_root? - root ? true : false - end - - # - def root - return @root if @root || @root_check - @root_check = true - @root = find_root - end - - # - def manifest - return nil unless root - @manifest ||= Dir.glob(root + 'manifest{,.txt}', File::FNM_CASEFOLD).first - end - - # - def scm - return nil unless root - @scm ||= %w{git hg}.find{ |m| (root + ".#{m}").directory? }.to_sym - end - - # - def files - return [] unless root - @files ||= \ - if manifest - File.readlines(manifest). - map{ |line| line.strip }. - reject{ |line| line.empty? || line[0,1] == '#' } - else - list = [] - Dir.chdir(root) do - FILES.split(/\s+/).each do |pattern| - list.concat(glob(pattern)) - end - OMIT.split(/\s+/).each do |pattern| - list = list - glob(pattern) - end - end - list - end.select{ |path| File.file?(path) }.uniq - end - - # - def glob_files(pattern) - return [] unless root - Dir.chdir(root) do - Dir.glob(pattern).select do |path| - File.file?(path) && files.include?(path) - end - end - end - - def patterns - PATTERNS - end - - def executables - @executables ||= \ - glob_files(patterns[:bin]).map do |path| - File.basename(path) - end - end - - def extensions - @extensions ||= \ - glob_files(patterns[:ext]).map do |path| - File.basename(path) - end - end - - def name - metadata['name'] || metadata['title'].downcase.gsub(/\W+/,'_') - end - - def homepage - page = ( - metadata['resources'].find{ |r| r['type'] =~ /^home/i } || - metadata['resources'].find{ |r| r['name'] =~ /^home/i } || - metadata['resources'].find{ |r| r['name'] =~ /^web/i } - ) - page ? page['uri'] : false - end - - def licenses - metadata['copyrights'].map{ |c| c['license'] }.compact - end - - def require_paths - paths = metadata['paths'] || {} - paths['load'] || ['lib'] - end - - # - # Convert to gemnspec. - # - def to_gemspec - if has_root? - Gem::Specification.new do |gemspec| - to_gemspec_data(gemspec) - to_gemspec_paths(gemspec) - end - else - Gem::Specification.new do |gemspec| - to_gemspec_data(gemspec) - to_gemspec_paths(gemspec) - end - end - end - - # - # Convert pure data settings. - # - def to_gemspec_data(gemspec) - gemspec.name = name - gemspec.version = metadata['version'] - gemspec.summary = metadata['summary'] - gemspec.description = metadata['description'] - - metadata['authors'].each do |author| - gemspec.authors << author['name'] - - if author.has_key?('email') - if gemspec.email - gemspec.email << author['email'] - else - gemspec.email = [author['email']] - end - end - end - - gemspec.licenses = licenses - - requirements = metadata['requirements'] || [] - requirements.each do |req| - next if req['optional'] - next if req['external'] - - name = req['name'] - groups = req['groups'] || [] - - version = gemify_version(req['version']) - - if groups.empty? or groups.include?('runtime') - # populate runtime dependencies - if gemspec.respond_to?(:add_runtime_dependency) - gemspec.add_runtime_dependency(name,*version) - else - gemspec.add_dependency(name,*version) - end - else - # populate development dependencies - if gemspec.respond_to?(:add_development_dependency) - gemspec.add_development_dependency(name,*version) - else - gemspec.add_dependency(name,*version) - end - end - end - - # convert external dependencies into gemspec requirements - requirements.each do |req| - next unless req['external'] - gemspec.requirements << ("%s-%s" % req.values_at('name', 'version')) - end - - gemspec.homepage = homepage - gemspec.require_paths = require_paths - gemspec.post_install_message = metadata['install_message'] - end - - # - # Set gemspec settings that require a root directory path. - # - def to_gemspec_paths(gemspec) - gemspec.files = files - gemspec.extensions = extensions - gemspec.executables = executables - - if Gem::VERSION < '1.7.' - gemspec.default_executable = gemspec.executables.first - end - - gemspec.test_files = glob_files(patterns[:test]) - - unless gemspec.files.include?('.document') - gemspec.extra_rdoc_files = glob_files(patterns[:doc]) - end - end - - # - # Return a copy of this file. This is used to generate a local - # .gemspec file that can automatically read the index file. - # - def self.source_code - File.read(__FILE__) - end - - private - - def find_root - root_files = patterns[:root] - if Dir.glob(root_files).first - Pathname.new(Dir.pwd) - elsif Dir.glob("../#{root_files}").first - Pathname.new(Dir.pwd).parent - else - #raise "Can't find root of project containing `#{root_files}'." - warn "Can't find root of project containing `#{root_files}'." - nil - end - end - - def glob(pattern) - if File.directory?(pattern) - Dir.glob(File.join(pattern, '**', '*')) - else - Dir.glob(pattern) - end - end - - def gemify_version(version) - case version - when /^(.*?)\+$/ - ">= #{$1}" - when /^(.*?)\-$/ - "< #{$1}" - when /^(.*?)\~$/ - "~> #{$1}" - else - version - end - end - - end - -end - -Indexer::GemspecExporter.gemspec \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..bdecda9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + pull_request: + workflow_dispatch: + # Monthly, to catch breakage from new Ruby or dependency releases + # when nothing has been pushed. + schedule: + - cron: '0 6 1 * *' + +permissions: + contents: read + +jobs: + test: + name: Ruby ${{ matrix.ruby }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4', '4.0'] + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Demos + run: bundle exec qed -Ilib demo/ + - name: Demos with frozen string literals + if: matrix.ruby == '4.0' + run: bundle exec qed -Ilib demo/ + env: + RUBYOPT: --enable=frozen-string-literal diff --git a/.gitignore b/.gitignore index eb1d234..98b9886 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,8 @@ *.gem *.lock -DEMO.md -.ergo/digest .yardoc doc/ log/ pkg/ tmp/ web/ - diff --git a/.index b/.index deleted file mode 100644 index 1cbf4b9..0000000 --- a/.index +++ /dev/null @@ -1,56 +0,0 @@ ---- -revision: 2013 -type: ruby -sources: -- index -authors: -- name: Thomas Sawyer - email: transfire@gmail.com -organizations: [] -requirements: -- groups: - - build - development: true - name: ergo -- groups: - - test - development: true - name: qed -- groups: - - test - development: true - name: ae -conflicts: [] -alternatives: [] -resources: -- type: home - uri: http://rubyworks.github.com/radix - label: Homepage -- type: code - uri: http://github.com/rubyworks/radix - label: Source Code -- type: bugs - uri: http://github.com/rubyworks/radix/issues - label: Issue Tracker -repositories: -- name: upstream - scm: git - uri: git://github.com/rubyworks/radix.git -categories: [] -copyrights: -- holder: '' - year: '2009' - license: BSD-2-Clause -customs: [] -paths: - lib: - - lib -name: radix -title: Radix -summary: Convert to and from any base. -created: '2009-07-01' -description: "Radix is a very easy to use Ruby library for converting numbers to and - from\nany base. It supports both Integer, Float and Rational numbers, as well as - \nrepresentational string-notations that need not be in ASCII order." -version: 2.2.1 -date: '2015-03-02' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 15f05dc..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -language: ruby -script: "bundle exec qed" -rvm: - - 2.1.0 - - 1.9.3 - - 1.9.2 - - 1.8.7 - - rbx - - jruby -matrix: - allow_failures: - - rvm: rbx - - rvm: rbx-2 -cache: bundler diff --git a/Assembly b/Assembly deleted file mode 100644 index 2bd1522..0000000 --- a/Assembly +++ /dev/null @@ -1,38 +0,0 @@ ---- -github: - gh_pages: web - -gem: - active: true - -dnote: - title: Source Notes - output: log/notes.html - -qed: - files: demo/ - -qedoc: - files: demo/ - title: Radix Demonstrations - output: - - DEMO.md - - web/demo.html - -locat: - active: false - -email: - service : Email - file : ~ - subject : ~ - mailto : - - ruby-talk@ruby-lang.org - - rubyworks-mailinglist@googlegroups.com - -vclog: - active: false - output: - - log/changes.html - - log/history.html - diff --git a/HISTORY.md b/HISTORY.md index 2b6cc1b..82b611a 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,26 @@ # RELEASE HISTORY +## Unreleased + +Radix's first changes since 2015 are housekeeping: the library does what it +did, on the Rubies in use today. + +Changes: + +* Require Ruby 2.7 or later, and test on Ruby 2.7 to 4.0. +* Remove `Radix.metadata` and the constants it supplied, other than + `Radix::VERSION`, which is now an ordinary constant. +* Remove the `Float#to_r` that was defined for Ruby 1.8. +* Fix the README's custom character set example, which used the same + character twice. (Javier Cejudo) +* Correct the README on string output for bases above 62. (Jakukyo Friel) +* Fix the README's arithmetic for `[100, 10]` in base 256, which is + `100*256 + 10`. +* Document and test that `String#b` without a base is Ruby's own method. +* Replace the Indexer, Assembly and Travis CI files with a standard gemspec, + a Rakefile and GitHub Actions. + + ## 2.2.1 / 2014-03-02 This release fixes a couple of issues. One unsettling issue in particular, diff --git a/MANIFEST b/MANIFEST deleted file mode 100644 index ea57af6..0000000 --- a/MANIFEST +++ /dev/null @@ -1,25 +0,0 @@ -#!mast .index .yardopts bin demo lib man spec test *.md *.txt -.index -.yardopts -demo/01_synopsis.md -demo/02_integer.md -demo/03_float.md -demo/04_rational.md -demo/05_base.md -demo/applique/ae.rb -demo/applique/check.rb -demo/applique/radix.rb -demo/issues/004_zero_empty_string.md -demo/issues/012_array_base.md -lib/radix/base.rb -lib/radix/float.rb -lib/radix/integer.rb -lib/radix/numeric.rb -lib/radix/operator.rb -lib/radix/rational.rb -lib/radix.rb -lib/radix.yml -README.md -HISTORY.md -DEMO.md -LICENSE.txt diff --git a/README.md b/README.md index df67f37..432cbed 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,9 @@ # Radix -[![Gem Version](http://img.shields.io/gem/v/radix.svg?style=flat)](https://rubygems.org/gems/radix) -    -[![Fork Me](http://img.shields.io/badge/scm-github-blue.svg?style=flat)](http://github.com/rubyworks/radix) -[![Report Issue](http://img.shields.io/github/issues/rubyworks/radix.svg?style=flat)](http://github.com/rubyworks/radix/issues) -[![Build Status](http://img.shields.io/travis/rubyworks/radix.svg?style=flat)](http://travis-ci.org/rubyworks/radix) -    -[![Gittip](http://img.shields.io/badge/gittip-$1/wk-green.svg?style=flat)](https://www.gittip.com/on/github/rubyworks/) -[![Flattr Me](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/324911/Rubyworks-Ruby-Development-Fund) +[![Gem Version](https://img.shields.io/gem/v/radix.svg?style=flat)](https://rubygems.org/gems/radix) +[![CI](https://github.com/rubyworks/radix/actions/workflows/ci.yml/badge.svg)](https://github.com/rubyworks/radix/actions/workflows/ci.yml) - -[Radix]((http://rubyworks.github.com/radix)) is a very easy to use Ruby library +[Radix](https://rubyworks.github.io/radix) is a very easy to use Ruby library for converting numbers to and from any base. It supports Integer, Float and Rational numbers, as well as representational string-notations that need not be in ASCII order. @@ -30,34 +23,33 @@ in ASCII order. Base conversions with ASCII ordered notations are easy in Ruby. ```ruby -255.to_s(16) #=> "FF" +255.to_s(16) #=> "ff" "FF".to_i(16) #=> 255 ``` -But Ruby reaches it's limit at base 36. +But Ruby reaches its limit at base 36. ```ruby -255.to_s(37) #=> Error +255.to_s(37) #=> ArgumentError ``` Radix provides the means of converting to and from any base. For example, a number in base 256 can be represented by the array `[100, 10]` -(`100**256 + 10**1`) and can be convert to base 10. +(`100*256 + 10`) and can be converted to base 10. ```ruby [100,10].b(256).to_a(10) #=> [2,5,6,1,0] ``` -Or, to get a string representation for any base up to 62. +Or, to get a string representation for any base. ```ruby [100,10].b(256).to_s(10) #=> "25610" ``` -A string representation of a number can be converted too, again, -up to base 62. +A string representation of a number can be converted too. ```ruby "10".b(62).to_s(10) #=> "62" @@ -68,28 +60,36 @@ rather than an integer. For example we can convert a base 10 number to another base 10 number using a different encoding. ```ruby -base = [:Q, :W, :E, :R, :T, :Y, :U, :I, :O, :U] +base = [:Q, :W, :E, :R, :T, :Y, :U, :I, :O, :P] "10".b(10).to_a(base) #=> [:W, :Q] ``` -To learn more have a look at the [QED Demo](http://rubydoc.info/gems/radix/file/DEMO.md). +To learn more have a look at the [demos](demo/), which are also Radix's +tests. + +### Ruby's own `String#b` + +Ruby has a `String#b` method of its own, which returns a copy of a string in +ASCII-8BIT encoding. Radix's `#b` takes a base; called without one, on a +string, it is still Ruby's method. If you would rather not use the core +extensions, the classes can be used directly: + +```ruby +Radix::Integer.new("10", 62).to_s(10) #=> "62" +``` ## Installing -If using Bundler, then add the ususal gem entry to your project's Gemfile. +Radix needs Ruby 2.7 or later. With Bundler, add it to your project's Gemfile: gem 'radix' -To install with RubyGems simply open a console and type: +Or install it with RubyGems: $ gem install radix -Radix follows [Ruby Setup](http://rubyworks.github.com/setup) package standard -so it can also be installed in an FHS compliant manner using setup.rb (very -old-school and no longer recommeded). - ## Special Thanks diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..5da4dbd --- /dev/null +++ b/Rakefile @@ -0,0 +1,22 @@ +require 'rake/clean' +CLOBBER.include 'pkg' + +require 'bundler/gem_helper' + +# Bundler tags releases as v1.2.3, but Radix's tags have always been +# plain version numbers (1.1.0 ... 2.2.0), so keep it that way. +class Bundler::GemHelper + def version_tag + version.to_s + end +end + +Bundler::GemHelper.install_tasks + +desc 'run demos' +task 'demo' do + sh 'qed -Ilib demo/' +end + +task 'test' => 'demo' +task 'default' => 'demo' diff --git a/demo/01_synopsis.md b/demo/01_synopsis.md index d1d43fe..01ae4de 100644 --- a/demo/01_synopsis.md +++ b/demo/01_synopsis.md @@ -37,7 +37,7 @@ To use a custom character set, use an array of characters as the base rather than an integer. For example we can convert a base 10 number to another base 10 number but useing a different encoding. - base = %w[Q W E R T Y U I O U] + base = %w[Q W E R T Y U I O P] "10".b(10).to_a(base) #=> ["W", "Q"] diff --git a/demo/issues/010_string_b.md b/demo/issues/010_string_b.md new file mode 100644 index 0000000..2b562ec --- /dev/null +++ b/demo/issues/010_string_b.md @@ -0,0 +1,21 @@ +# Ruby's String#b (Issue #10) + +Since version 2.0, Ruby has had a `String#b` method of its own, which returns +a copy of the string in ASCII-8BIT encoding. Radix uses the same name, with a +base, to make a Radix number from a string. + + "10".b(62).to_i #=> 62 + +Called without a base, it is still Ruby's method. + + string = "héllo" + binary = string.b + + binary.encoding #=> Encoding::ASCII_8BIT + binary.bytes #=> string.bytes + binary.equal?(string).assert == false + string.encoding #=> Encoding::UTF_8 + +Ruby's method is also available as `String#ascii`. + + "héllo".ascii.encoding #=> Encoding::ASCII_8BIT diff --git a/index/authors b/index/authors deleted file mode 100644 index ba213a0..0000000 --- a/index/authors +++ /dev/null @@ -1,2 +0,0 @@ ---- -- Thomas Sawyer diff --git a/index/copyrights b/index/copyrights deleted file mode 100644 index 078b9c1..0000000 --- a/index/copyrights +++ /dev/null @@ -1,3 +0,0 @@ ---- -- (c) Thomas Sawyer, Rubyworks 2009 (BSD-2-Clause) - diff --git a/index/created b/index/created deleted file mode 100644 index 3f70226..0000000 --- a/index/created +++ /dev/null @@ -1 +0,0 @@ -2009-07-01 diff --git a/index/description b/index/description deleted file mode 100644 index 2014956..0000000 --- a/index/description +++ /dev/null @@ -1,3 +0,0 @@ -Radix is a very easy to use Ruby library for converting numbers to and from -any base. It supports both Integer, Float and Rational numbers, as well as -representational string-notations that need not be in ASCII order. diff --git a/index/name b/index/name deleted file mode 100644 index 4e0dc5f..0000000 --- a/index/name +++ /dev/null @@ -1 +0,0 @@ -radix diff --git a/index/organization b/index/organization deleted file mode 100644 index 6562643..0000000 --- a/index/organization +++ /dev/null @@ -1 +0,0 @@ -Rubyworks diff --git a/index/repositories b/index/repositories deleted file mode 100644 index 9641a0a..0000000 --- a/index/repositories +++ /dev/null @@ -1,2 +0,0 @@ ---- -upstream: git://github.com/rubyworks/radix.git diff --git a/index/requirements b/index/requirements deleted file mode 100644 index 194679b..0000000 --- a/index/requirements +++ /dev/null @@ -1,4 +0,0 @@ ---- -- ergo (build) -- qed (test) -- ae (test) diff --git a/index/resources b/index/resources deleted file mode 100644 index b3f7e3b..0000000 --- a/index/resources +++ /dev/null @@ -1,5 +0,0 @@ ---- -home: http://rubyworks.github.com/radix -code: http://github.com/rubyworks/radix -bugs: http://github.com/rubyworks/radix/issues - diff --git a/index/summary b/index/summary deleted file mode 100644 index da34544..0000000 --- a/index/summary +++ /dev/null @@ -1 +0,0 @@ -Convert to and from any base. diff --git a/index/title b/index/title deleted file mode 100644 index ac9b187..0000000 --- a/index/title +++ /dev/null @@ -1 +0,0 @@ -Radix diff --git a/index/version b/index/version deleted file mode 100644 index c043eea..0000000 --- a/index/version +++ /dev/null @@ -1 +0,0 @@ -2.2.1 diff --git a/lib/radix.rb b/lib/radix.rb index bce2cc3..fd6dd76 100644 --- a/lib/radix.rb +++ b/lib/radix.rb @@ -1,32 +1,6 @@ +require 'radix/version' require 'radix/base' require 'radix/integer' require 'radix/float' require 'radix/rational' require 'radix/operator' - -module Radix - - ## - # Returns the metadata contained in Radix.yml - # - # @return [Hash{String=>String}] - def self.metadata - @metadata ||= ( - require 'yaml' - YAML.load(File.new(File.dirname(__FILE__) + '/radix.yml')) - ) - end - - ## - # Gets value of name in metadata or goes up ancestry. - # - # @param [Symbol] name - # - # @return [String] - def self.const_missing(name) - key = name.to_s.downcase - metadata.key?(key) ? metadata[key] : super(name) - end - -end - diff --git a/lib/radix.yml b/lib/radix.yml deleted file mode 120000 index f018114..0000000 --- a/lib/radix.yml +++ /dev/null @@ -1 +0,0 @@ -../.index \ No newline at end of file diff --git a/lib/radix/float.rb b/lib/radix/float.rb index 511fe06..48cf5d6 100644 --- a/lib/radix/float.rb +++ b/lib/radix/float.rb @@ -286,7 +286,7 @@ def eql?(num) # Any Numeric instance. # # @return [Boolean] True if values are equal. - def ==(other) + def ==(other) case other when Float, Integer # Radix value == other.value diff --git a/lib/radix/operator.rb b/lib/radix/operator.rb index 927c29f..7ed6920 100644 --- a/lib/radix/operator.rb +++ b/lib/radix/operator.rb @@ -40,16 +40,10 @@ def b(base) # instances. class ::String - # Ruby 2.x defines it's own `String#b` method for converting to ASCII 8-bit. - # That breaks Radix (of course), but it a terrbile name. `String#ascii` is - # much better (duh!). So that's what we are doing. - if method_defined?(:b) - alias :ascii :b - else - def ascii - force_encoding('ASCII') - end - end + # Ruby's own `String#b`, which returns a copy of the string in ASCII-8BIT + # encoding. It is kept under this name, because Radix's `#b` takes over + # when it is given a base. + alias :ascii :b unless method_defined?(:ascii) ## # Takes a String and makes it into a Radix::Integer or Radix::Float as given @@ -58,7 +52,10 @@ def ascii # @param [Fixnum, Array] base # The desired base. # - # @return [Radix::Integer, Radix::Float] + # Without a base this is Ruby's own `String#b`, and returns a copy of + # the string in ASCII-8BIT encoding. + # + # @return [Radix::Integer, Radix::Float, String] def b(base=nil) return ascii unless base diff --git a/lib/radix/rational.rb b/lib/radix/rational.rb index 72bf69f..5311e45 100644 --- a/lib/radix/rational.rb +++ b/lib/radix/rational.rb @@ -292,20 +292,3 @@ def br(base=nil) Radix::Rational.new(*args) end end - -if RUBY_VERSION < '1.9' - class ::Float - - ## - # Adds a #to_r method to pre-1.9 ruby Rationals. - # - # @return [Rational] - def to_r - n, f = to_s.split('.') - d = (10 ** f.size).to_i - n = (n.to_i * d) + f.to_i - Rational(n, d) - end - end -end - diff --git a/lib/radix/version.rb b/lib/radix/version.rb new file mode 100644 index 0000000..f39dd8c --- /dev/null +++ b/lib/radix/version.rb @@ -0,0 +1,3 @@ +module Radix + VERSION = '2.2.1' +end diff --git a/radix.gemspec b/radix.gemspec new file mode 100644 index 0000000..1b8d855 --- /dev/null +++ b/radix.gemspec @@ -0,0 +1,36 @@ +require_relative 'lib/radix/version' + +Gem::Specification.new do |s| + s.name = 'radix' + s.version = Radix::VERSION + s.summary = 'Convert to and from any base.' + s.description = 'Radix is a very easy to use Ruby library for converting numbers to and from ' \ + 'any base. It supports Integer, Float and Rational numbers, as well as ' \ + 'representational string-notations that need not be in ASCII order.' + + s.authors = ['Trans'] + s.email = ['transfire@gmail.com'] + s.homepage = 'https://rubyworks.github.io/radix' + s.license = 'BSD-2-Clause' + + s.metadata = { + 'homepage_uri' => s.homepage, + 'source_code_uri' => 'https://github.com/rubyworks/radix', + 'bug_tracker_uri' => 'https://github.com/rubyworks/radix/issues', + 'changelog_uri' => 'https://github.com/rubyworks/radix/blob/master/HISTORY.md', + 'documentation_uri' => 'https://rubydoc.info/gems/radix' + } + + s.required_ruby_version = '>= 2.7' + + s.files = Dir[ + 'lib/**/*.rb', 'demo/**/*', + '.yardopts', 'README.md', 'HISTORY.md', 'LICENSE.txt' + ] + s.require_paths = ['lib'] + s.extra_rdoc_files = ['LICENSE.txt', 'HISTORY.md', 'README.md'] + + s.add_development_dependency 'rake', '>= 13' + s.add_development_dependency 'qed', '>= 2.9' + s.add_development_dependency 'ae', '>= 1.8' +end