dkubb / axiom-types Goto Github PK
View Code? Open in Web Editor NEWDefine types with optional constraints
License: MIT License
Define types with optional constraints
License: MIT License
Part of the stacktrace
FloatDomainError: Infinity
from /home/homer/.rvm/gems/ruby-1.9.3-p429@axiom/bundler/gems/axiom-types-d5b85bf34b53/lib/axiom/types/type.rb:141:in `to_r'
How to reproduce
operand = BigDecimal('1')
Axiom::Types::Decimal.include? operand
Hi,
I've been using a beta version of Virtus in a Ruby 1.8.7
app and between beta0 and the first release candidate, it began to use axiom-types
with a version that changed the lambda to use the 1.9
syntax.
That make axiom-type and every gem that depends on it dependent on Ruby >= 1.9
.
It's not an issue by itself, and it's time to move on wit Ruby and let go of 1.8.7
.
The issue is that it's not explicit, neither in the README not in the gemspec.
It is possible to add this in the gem spec, according to the Rubygems specification.
Thanks for you hard open-source work.
The latest commit c8a2f0b causes some failures under jruby:
https://travis-ci.org/dkubb/axiom-types/builds/11922533
It is likely this is exposing a bug in jruby, confirm if this is the case and submit a bug report upstream to the JRuby project.
Is there a reason why this is missing? (aside from being possibly overlooked) ๐.
After installing axiom-types-0.1.1 using gem install axiom-types
, some files have unexpected permissions:
axiom-types-0.1.1/.ruby-gemset
axiom-types-0.1.1/LICENSE
axiom-types-0.1.1/.yardopts
axiom-types-0.1.1/TODO
axiom-types-0.1.1/Rakefile
axiom-types-0.1.1/config/devtools.yml
axiom-types-0.1.1/config/yardstick.yml
axiom-types-0.1.1/config/roodi.yml
axiom-types-0.1.1/config/mutant.yml
axiom-types-0.1.1/Guardfile
axiom-types-0.1.1/.gitignore
Is there a reason these files permissions are not 644 ?
Hello,
During 'grape' gem integration (rack API framework) and Mongoid I encountered an issue with ActiveSupport and Axiom.
Final stacktrace occurs while calling Class that is including Mongoid::Document.
ArgumentError: comparison of Class with Class failed
from org/jruby/RubyComparable.java:168:in `<'
from /Users/ernest.bursa/.rvm/gems/jruby-1.7.6@ayeappz/gems/activesupport-4.0.1/lib/active_support/core_ext/class/subclasses.rb:19:in `descendants'
from org/jruby/RubyObjectSpace.java:173:in `each_object'
...
I have examined that there is problem with class Axiom::Types::Infinity. That class can not be compared to other classes (done by ActiveSupport in subclasses.rb)
Excerpt from subclasses.rb:
def descendants # :nodoc:
...
rescue StandardError # JRuby
def descendants # :nodoc:
descendants = []
ObjectSpace.each_object(Class) do |k|
descendants.unshift k if k < self # fails here
end
descendants.uniq!
descendants
end
end
Are we able to make Axiom::Types::Infinity comparable?
while building your gem for Debian, rake tests fails with missing shared examples
/usr/lib/ruby/vendor_ruby/rspec/core/example_group.rb:168:in `find_and_eval_shared': Could not find shared examples "a command method" (ArgumentError)
from /usr/lib/ruby/vendor_ruby/rspec/core/example_group.rb:120:in `block in it_should_behave_like'
from /usr/lib/ruby/vendor_ruby/rspec/core/example_group.rb:246:in `module_eval'
from /usr/lib/ruby/vendor_ruby/rspec/core/example_group.rb:246:in `subclass'
from /usr/lib/ruby/vendor_ruby/rspec/core/example_group.rb:232:in `describe'
from /usr/lib/ruby/vendor_ruby/rspec/core/example_group.rb:119:in `it_should_behave_like'
from /tmp/ruby-axiom-types-0.1.0/spec/unit/axiom/types/class_methods/finalize_spec.rb:11:in `block in <top (required)>'
from /usr/lib/ruby/vendor_ruby/rspec/core/example_group.rb:246:in `module_eval'
from /usr/lib/ruby/vendor_ruby/rspec/core/example_group.rb:246:in `subclass'
from /usr/lib/ruby/vendor_ruby/rspec/core/example_group.rb:232:in `describe'
from /usr/lib/ruby/vendor_ruby/rspec/core/dsl.rb:18:in `describe'
from /tmp/ruby-axiom-types-0.1.0/spec/unit/axiom/types/class_methods/finalize_spec.rb:5:in `<top (required)>'
from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:896:in `load'
from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:896:in `block in load_spec_files'
from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:896:in `each'
from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:896:in `load_spec_files'
from /usr/lib/ruby/vendor_ruby/rspec/core/command_line.rb:22:in `run'
from /usr/lib/ruby/vendor_ruby/rspec/core/runner.rb:80:in `run'
from /usr/lib/ruby/vendor_ruby/rspec/core/runner.rb:17:in `block in autorun'
Right now I must do this:
Axiom::Types::Object.new { primitive some_model }
As it's needed by EV attribute in Virtus. I was wondering if axiom-types could actually do that automatically via infer. Something like that maybe:
type = Axiom::Types.infer(some_model)
type.class # Axiom::Types::Object
type.primitive # some_model
I've no idea if it makes sense from the axiom-types point of view though.
its
is gone from rspec 3: https://gist.github.com/myronmarston/4503509
It would be a good idea to remove the dependency from axiom-types.
irb(main):001:0> Axiom::Types.infer(Set[Float]).member_type
=> Axiom::Types::Float
irb(main):002:0> Axiom::Types.infer(Set).member_type
=> Axiom::Types::Float
Same happens with Array
. Basically to reproduce it just infer a collection type with a member type and then try to inferring again but without member type. The previous member type will be set for some reason.
I am using virtus
which is using axiom-types
, and if I define a module like this:
module MyNamespace
module Translatable
end
end
Then it throws the following:
NoMethodError: undefined method `finalize' for nil:NilClass
from .../vendor/bundle/gems/axiom-types-0.0.4/lib/axiom/types/collection.rb:59:in `finalize'
If I were to rename my module-name to something else it would work. This specific module doesn't have anything to do with virtus
or axiom-types
. It is just plain empty so far.
I noticed when you build a new type class its name
method returns nil and its inspect
is not very informative. For instance:
irb(main):019:0> type = Axiom::Types::Object.new { primitive String }
=> #<Class:0x007fbc77c0f6f8>
irb(main):020:0> type.name
=> nil
irb(main):021:0> type.inspect
=> "#<Class:0x007fbc77c0f6f8>"
I guess name must return nil but inspect could show some meaningful information about the type class.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.