Module: Navi::Navigator::InstanceMethods

Included in:
Base
Defined in:
lib/navi/navigator/instance_methods.rb

Instance Method Summary collapse

Instance Method Details

#highlights_onObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/navi/navigator/instance_methods.rb', line 32

def highlights_on
  db_value = self.read_attribute :highlights_on
  value = if db_value
            Regexp.new db_value
          else # db_value.nil?
            if navigable && navigable_config(:highlights_on)
              config = navigable_config(:highlights_on)
              case config
              when Proc then config.call navigable
              else config
              end
            else
              self.url
            end
          end
end

#labelObject



4
5
6
7
8
9
# File 'lib/navi/navigator/instance_methods.rb', line 4

def label
  db_value = self.read_attribute :label
  return db_value if db_value
  return navigable.send navigable_config(:label) if navigable && navigable_config(:label)
  nil
end

#titleObject



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/navi/navigator/instance_methods.rb', line 18

def title
  db_value = self.read_attribute :title
  return db_value if db_value
  if navigable && navigable_config(:title)
    config = navigable_config :title
    return case config
      when Symbol then navigable.send config
      when String then config
      when Proc then config.call navigable
      end
  end
  return self.label
end

#urlObject



11
12
13
14
15
16
# File 'lib/navi/navigator/instance_methods.rb', line 11

def url
  db_value = self.read_attribute :url
  return db_value if db_value
  return navigable if navigable
  nil
end