Sha256: 2d5ec7a3eede291e5709acf3c43a998be3f7a76b18f65d3fc45d73cef7c6031b

Contents?: true

Size: 489 Bytes

Versions: 1

Compression:

Stored size: 489 Bytes

Contents

module Domain
  module CoercionMethods

    def coercions(&bl)
      @coercions ||= ::Myrrha::Coercions.new{|c| c.main_target_domain = self}
      @coercions.append(&bl) if bl
      @coercions
    end

    def coerce(arg)
      coercions.coerce(arg, self)
    rescue Myrrha::Error
      domain_error!(arg)
    end

    def [](first, *args)
      args.empty? ? coerce(first) : coerce(args.unshift(first))
    end

  end # module CoercionMethods
  include CoercionMethods
end # module Domain

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
myrrha-3.0.0.rc2 lib/myrrha/ext/domain.rb