Class: Prefab::ContextShape

Inherits:
Object
  • Object
show all
Defined in:
lib/prefab/context_shape.rb

Constant Summary collapse

MAPPING =
{
  Integer => 1,
  String => 2,
  Float => 4,
  TrueClass => 5,
  FalseClass => 5,
  Array => 10,
}.freeze
DEFAULT =

We default to String if the type isn’t a primitive we support. This is because we do a ‘to_s` in the CriteriaEvaluator.

MAPPING[String]

Class Method Summary collapse

Class Method Details

.field_type_number(value) ⇒ Object



16
17
18
# File 'lib/prefab/context_shape.rb', line 16

def self.field_type_number(value)
  MAPPING.fetch(value.class, DEFAULT)
end