Class: ApplicationEntity

Inherits:
Dry::Struct
  • Object
show all
Defined in:
app/entities/application_entity.rb

Constant Summary collapse

DEFAULT_CONTEXT =
'https://schema.org'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extra(key, value) ⇒ Object



15
16
17
# File 'app/entities/application_entity.rb', line 15

def extra(key, value)
  extras[key] = value
end

.extrasObject



11
12
13
# File 'app/entities/application_entity.rb', line 11

def extras
  @extras ||= {}
end

.type(value) ⇒ Object



19
20
21
# File 'app/entities/application_entity.rb', line 19

def type(value)
  extra('@type', value)
end

Instance Method Details

#dump(ref = nil) ⇒ Object



32
33
34
# File 'app/entities/application_entity.rb', line 32

def dump(ref = nil)
  @dump ||= build_extras(ref).merge(dump_attributes)
end

#to_hObject



24
25
26
# File 'app/entities/application_entity.rb', line 24

def to_h
  dump
end

#to_json(*args) ⇒ Object



28
29
30
# File 'app/entities/application_entity.rb', line 28

def to_json(*args)
  super.html_safe
end