Class: Jbuilder::Schema::Template::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/jbuilder/schema/template.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(object: nil, object_title: nil, object_description: nil) ⇒ Object



28
29
30
# File 'lib/jbuilder/schema/template.rb', line 28

def self.build(object: nil, object_title: nil, object_description: nil, **)
  new(object: object, title: object_title, description: object_description)
end

Instance Method Details

#descriptionObject



36
37
38
# File 'lib/jbuilder/schema/template.rb', line 36

def description
  super || translate(description_keys)
end

#titleObject



32
33
34
# File 'lib/jbuilder/schema/template.rb', line 32

def title
  super || translate(title_keys)
end

#translate_description(key) ⇒ Object



44
45
46
# File 'lib/jbuilder/schema/template.rb', line 44

def translate_description(key)
  translate(description_keys.map { |k| "fields.#{key}.#{k}" })
end

#translate_title(key) ⇒ Object



40
41
42
# File 'lib/jbuilder/schema/template.rb', line 40

def translate_title(key)
  translate(title_keys.map { |k| "fields.#{key}.#{k}" })
end