Module: HashArray

Included in:
JekyllSupport::HRefTag
Defined in:
lib/hash_array.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



28
29
30
# File 'lib/hash_array.rb', line 28

def add_global_link_for_page(href)
  add_link_for_page(href, HashArray.instance_variable_get(:@global_hrefs))
end


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/hash_array.rb', line 7

def add_link_for_page(href, hash)
  enclosing_page = href.path
  hash[enclosing_page] = hash[enclosing_page] || []
  pre_existing = hash[enclosing_page].find { |h| h.link_save == href.link_save }
  if pre_existing
    if pre_existing.follow != href.follow
      @logger.warn <<~END_WARN
        HRef tags for '#{href.link}' have inconsistent 'follow' keyword options on line #{href.line_number} of #{enclosing_page}:
          Previous value: #{pre_existing.follow}
           Current value: #{href.follow}
      END_WARN
    end
  else
    hash[enclosing_page] << href unless href.summary_exclude
  end
end


24
25
26
# File 'lib/hash_array.rb', line 24

def add_local_link_for_page(href)
  add_link_for_page(href, HashArray.instance_variable_get(:@local_hrefs))
end

.resetObject



2
3
4
5
# File 'lib/hash_array.rb', line 2

def reset
  @local_hrefs = {}
  @global_hrefs = {}
end

Instance Method Details



28
29
30
# File 'lib/hash_array.rb', line 28

def add_global_link_for_page(href)
  add_link_for_page(href, HashArray.instance_variable_get(:@global_hrefs))
end


24
25
26
# File 'lib/hash_array.rb', line 24

def add_local_link_for_page(href)
  add_link_for_page(href, HashArray.instance_variable_get(:@local_hrefs))
end

#resetObject



2
3
4
5
# File 'lib/hash_array.rb', line 2

def reset
  @local_hrefs = {}
  @global_hrefs = {}
end