Sha256: 262bd92526e370ef6f64d8779cd7f1ce7f43a92a712af2e4fadfcb681a9c527f

Contents?: true

Size: 356 Bytes

Versions: 69

Compression:

Stored size: 356 Bytes

Contents

# frozen_string_literal: true

module ReeEnum::Contractable
  include Ree::Contracts::Truncatable

  def valid?(value)
    value.is_a?(ReeEnum::Value) && value.enum_name == self.enum_name && all.include?(value)
  end

  def message(value, name, lvl = 1)
    return "expected one of #{self.name}, got #{value.class} => #{truncate(value.inspect)}"
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
ree_lib-1.0.29 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.28 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.27 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.26 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.24 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.23 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.22 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.21 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.20 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.19 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.18 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.17 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.16 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.15 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.14 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.13 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.12 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.11 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.10 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb
ree_lib-1.0.9 lib/ree_lib/packages/ree_enum/package/ree_enum/contractable.rb