Class: HasHelpers::Types::Search::ResultType

Inherits:
BaseType
  • Object
show all
Defined in:
app/graphql/has_helpers/types/search/result_type.rb

Instance Method Summary collapse

Methods inherited from BaseType

#current_organization, #current_user

Instance Method Details

#abbreviationObject



48
49
50
# File 'app/graphql/has_helpers/types/search/result_type.rb', line 48

def abbreviation
  object.try(:abbreviation)
end

#base_typeObject



28
29
30
# File 'app/graphql/has_helpers/types/search/result_type.rb', line 28

def base_type
  type.safe_constantize&.base_class&.name
end

#detailsObject



52
53
54
# File 'app/graphql/has_helpers/types/search/result_type.rb', line 52

def details
  object.try(:detail)
end

#idObject



20
21
22
# File 'app/graphql/has_helpers/types/search/result_type.rb', line 20

def id
  object.try(:id)
end

#image_urlObject



36
37
38
# File 'app/graphql/has_helpers/types/search/result_type.rb', line 36

def image_url
  photo_service&.url
end

#nameObject



32
33
34
# File 'app/graphql/has_helpers/types/search/result_type.rb', line 32

def name
  object.try(:name)
end

#sub_itemObject



40
41
42
# File 'app/graphql/has_helpers/types/search/result_type.rb', line 40

def sub_item
  object.try(:sub_item)
end

#sub_item_typeObject



44
45
46
# File 'app/graphql/has_helpers/types/search/result_type.rb', line 44

def sub_item_type
  object.try(:sub_item_type)
end

#typeObject



24
25
26
# File 'app/graphql/has_helpers/types/search/result_type.rb', line 24

def type
  object.try(:type) || object.class.name
end