Class: Inferno::Web::Serializers::Serializer

Inherits:
Blueprinter::Base
  • Object
show all
Defined in:
lib/inferno/apps/web/serializers/serializer.rb

Class Method Summary collapse

Class Method Details

.field_present?(field_name, result, options) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
# File 'lib/inferno/apps/web/serializers/serializer.rb', line 8

def self.field_present?(field_name, result, options)
  name = options[:name] || field_name
  if result.respond_to?(:[])
    result[name].present?
  else
    result.send(name).present?
  end
end