Class: ElasticGraph::GraphQL::ScalarCoercionAdapters::Longs

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_graph/graphql/scalar_coercion_adapters/longs.rb

Class Method Summary collapse

Class Method Details

.to_ruby_int_in_range(value, min, max) ⇒ Object



15
16
17
18
19
# File 'lib/elastic_graph/graphql/scalar_coercion_adapters/longs.rb', line 15

def self.to_ruby_int_in_range(value, min, max)
  value = Integer(value, exception: false)
  return nil if value.nil? || value > max || value < min
  value
end