Module: Guts::NavigatableConcern::ClassMethods

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

Overview

Class methods for the concern

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

Returns the configuration for the navigatable object.

Returns:

  • (Hash)

    the configuration for the navigatable object



25
26
27
# File 'app/concerns/guts/navigatable_concern.rb', line 25

def navigatable_opts
  @navigatable_opts
end

Instance Method Details

Allows a class to be navigatable

Examples:

Example for Content model

# This will convert the format into something like: "[Page] Test"
navigatable :"type.title", :title, format: "[:type.title] :title"

Parameters:

  • variables (Array)

    the variables to access from the model

  • opts (Hash)

    the options for the concern

Options Hash (**opts):

  • :format (String)

    the text format to use with variables



34
35
36
37
38
39
# File 'app/concerns/guts/navigatable_concern.rb', line 34

def navigatable(*variables, **opts)
  @navigatable_opts = {
    variables: variables,
    format: opts[:format]
  }
end