Coder Social home page Coder Social logo

axiom-types's People

Contributors

dkubb avatar gix avatar ktdreyer avatar mbj avatar snusnu avatar solnic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

axiom-types's Issues

FloatDomainError: Infinity checking type for BigDecimal

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

Ruby version compatibility

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.

Pathname?

Is there a reason why this is missing? (aside from being possibly overlooked) ๐Ÿ‘.

gem files permissions wrong?

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 ?

Problem with Axiom and ActiveSupport

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?

it_should_behave_like - Could not find shared examples "a command method"

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'

Setting an arbitrary class as the primitive

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.

Inferring member 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.

undefined method `finalize' for nil:NilClass when creating a namespaced module called Translatable

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.

name and inspect of a custom type class

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.