Sha256: 34ea44d041ada416f479fdf6c7f321125cd4cc8e89c9053223ab9fe9b7d061a7

Contents?: true

Size: 1.14 KB

Versions: 9

Compression:

Stored size: 1.14 KB

Contents

module Finitio
  #
  # An AnyType generator allows capuring the set of every ruby citizen as a
  # Finitio type.
  #
  #     Any := .
  #
  # Object is used as concrete representation of the information type as the
  # Ruby `Object` class already captures everything.
  #
  #     R(.) = Object
  #
  # Accordingly, the `dress` transformation function has the signature below.
  # Note that dress always succeeds and returns its first argument.
  #
  #     dress :: Alpha  -> Object throws TypeError
  #     dress :: Object -> Object throws TypeError
  #
  class AnyType < Type

    def initialize(name = nil, metadata = nil)
      super(name, metadata)
    end

    def default_name
      "Any"
    end

    def representator
      Object
    end

    def include?(value)
      true
    end

    def dress(value, handler = nil)
      value
    end

    def suppremum(other)
      self
    end

    def _suppremum(other)
      self
    end

    def ==(other)
      super || other.is_a?(AnyType)
    end
    alias :eql? :==

    def hash
      self.class.hash ^ 37
    end

    def resolve_proxies(system)
      self
    end

  end # class AnyType
end # module Finitio

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
finitio-0.12.0 lib/finitio/type/any_type.rb
finitio-0.11.4 lib/finitio/type/any_type.rb
finitio-0.11.3 lib/finitio/type/any_type.rb
finitio-0.11.2 lib/finitio/type/any_type.rb
finitio-0.11.1 lib/finitio/type/any_type.rb
finitio-0.10.0 lib/finitio/type/any_type.rb
finitio-0.9.1 lib/finitio/type/any_type.rb
finitio-0.9.0 lib/finitio/type/any_type.rb
finitio-0.8.0 lib/finitio/type/any_type.rb