Method: Guts::NavigatableConcern#navigatable_format

Defined in:
app/concerns/guts/navigatable_concern.rb
Note:

This method uses instance_eval to get the instance variables.. :title to self.title, :type.title to self.type.title

Renders a string based on options from the model

Returns:

  • (String)

    compiled string based on format and variables

See Also:



12
13
14
15
16
17
18
19
# File 'app/concerns/guts/navigatable_concern.rb', line 12

def navigatable_format
  formatted = self.class.navigatable_opts[:format]
  self.class.navigatable_opts[:variables].each do |var|
    formatted = formatted.gsub(/\:#{var}/, instance_eval("self.#{var}"))
  end
  
  formatted
end