class Muwu::Helper::OutlineHelper

Public Class Methods

new(outline_fragment) click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 9
def initialize(outline_fragment)
  @outline_fragment = outline_fragment
end

Protected Class Methods

type_of(step) click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 138
def self.type_of(step)
  s = new(step)
  if s.indicates_contents
    :contents
  elsif s.indicates_metadata
    :metadata
  elsif s.indicates_navigator
    :navigator
  elsif s.indicates_outline_fragment
    :outline_fragment
  elsif s.indicates_subcontents
    :subcontents
  elsif s.indicates_text
    :text
  elsif s.indicates_title
    :title
  end
end

Public Instance Methods

includes_navigator() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 18
def includes_navigator
  indicates_navigator || includes_navigator_in_array
end
includes_navigator_in_array() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 23
def includes_navigator_in_array
  (is_array) && (@outline_fragment.select{ |step| OutlineHelper.type_of(step) == :navigator }.any?)
end
indicates_contents() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 28
def indicates_contents
  indicates_contents_hash || indicates_contents_string
end
indicates_contents_hash() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 33
def indicates_contents_hash
  (is_hash) && (RegexpLib.outline_contents =~ @outline_fragment.flatten[0])
end
indicates_contents_string() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 38
def indicates_contents_string
  (is_string) && (RegexpLib.outline_contents =~ @outline_fragment)
end
indicates_metadata() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 43
def indicates_metadata
  indicates_metadata_hash || indicates_metadata_string
end
indicates_metadata_hash() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 48
def indicates_metadata_hash
  (is_hash) && (RegexpLib.outline_metadata =~ @outline_fragment.flatten[0])
end
indicates_metadata_string() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 53
def indicates_metadata_string
  (is_string) && (RegexpLib.outline_metadata =~ @outline_fragment)
end
indicates_navigator() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 58
def indicates_navigator
  (is_string) && (RegexpLib.outline_navigator =~ @outline_fragment)
end
indicates_outline_fragment() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 63
def indicates_outline_fragment
  is_array
end
indicates_subcontents() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 68
def indicates_subcontents
  indicates_subcontents_hash || indicates_subcontents_string
end
indicates_subcontents_hash() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 73
def indicates_subcontents_hash
  (is_hash) && (RegexpLib.outline_subcontents =~ @outline_fragment.flatten[0])
end
indicates_subcontents_string() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 78
def indicates_subcontents_string
  (is_string) && (RegexpLib.outline_subcontents =~ @outline_fragment)
end
indicates_text() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 83
def indicates_text
  (is_hash) && (RegexpLib.outline_text =~ @outline_fragment.flatten[0])
end
indicates_title() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 88
def indicates_title
  indicates_title_hash || indicates_title_string
end
indicates_title_hash() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 93
def indicates_title_hash
  (is_hash) && (RegexpLib.outline_title =~ @outline_fragment.flatten[0])
end
indicates_title_string() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 98
def indicates_title_string
  (is_string) && (RegexpLib.outline_title =~ @outline_fragment)
end
is_array() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 103
def is_array
  Array === @outline_fragment
end
is_hash() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 108
def is_hash
  Hash === @outline_fragment
end
is_integer() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 113
def is_integer
  Integer === @outline_fragment
end
is_string() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 118
def is_string
  String === @outline_fragment
end
text_step_flexible_suggests_file() click to toggle source
# File lib/muwu/helper/outline_helper.rb, line 123
def text_step_flexible_suggests_file
  if @outline_fragment.to_s =~ RegexpLib.file_ext_md
    true
  elsif @outline_fragment.to_s =~ RegexpLib.file_ext_haml
    true
  else
    false
  end
end