Class: Muwu::Helper::OutlineHelper
- Inherits:
-
Object
- Object
- Muwu::Helper::OutlineHelper
- Includes:
- Muwu::Helper
- Defined in:
- lib/muwu/helper/outline_helper.rb
Instance Method Summary collapse
- #includes_navigator ⇒ Object
- #includes_navigator_in_array ⇒ Object
- #indicates_contents ⇒ Object
- #indicates_contents_hash ⇒ Object
- #indicates_contents_string ⇒ Object
- #indicates_metadata ⇒ Object
- #indicates_metadata_hash ⇒ Object
- #indicates_metadata_string ⇒ Object
- #indicates_navigator ⇒ Object
- #indicates_outline_fragment ⇒ Object
- #indicates_subcontents ⇒ Object
- #indicates_subcontents_hash ⇒ Object
- #indicates_subcontents_string ⇒ Object
- #indicates_text ⇒ Object
- #indicates_title ⇒ Object
- #indicates_title_hash ⇒ Object
- #indicates_title_string ⇒ Object
-
#initialize(outline_fragment) ⇒ OutlineHelper
constructor
A new instance of OutlineHelper.
- #is_array ⇒ Object
- #is_hash ⇒ Object
- #is_integer ⇒ Object
- #is_string ⇒ Object
- #text_step_flexible_suggests_file ⇒ Object
Constructor Details
#initialize(outline_fragment) ⇒ OutlineHelper
Returns a new instance of OutlineHelper.
9 10 11 |
# File 'lib/muwu/helper/outline_helper.rb', line 9 def initialize(outline_fragment) @outline_fragment = outline_fragment end |
Instance Method Details
#includes_navigator ⇒ Object
18 19 20 |
# File 'lib/muwu/helper/outline_helper.rb', line 18 def includes_navigator indicates_navigator || includes_navigator_in_array end |
#includes_navigator_in_array ⇒ Object
23 24 25 |
# 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 ⇒ Object
28 29 30 |
# File 'lib/muwu/helper/outline_helper.rb', line 28 def indicates_contents indicates_contents_hash || indicates_contents_string end |
#indicates_contents_hash ⇒ Object
33 34 35 |
# 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 ⇒ Object
38 39 40 |
# File 'lib/muwu/helper/outline_helper.rb', line 38 def indicates_contents_string (is_string) && (RegexpLib.outline_contents =~ @outline_fragment) end |
#indicates_metadata ⇒ Object
43 44 45 |
# File 'lib/muwu/helper/outline_helper.rb', line 43 def || end |
#indicates_metadata_hash ⇒ Object
48 49 50 |
# File 'lib/muwu/helper/outline_helper.rb', line 48 def (is_hash) && (RegexpLib. =~ @outline_fragment.flatten[0]) end |
#indicates_metadata_string ⇒ Object
53 54 55 |
# File 'lib/muwu/helper/outline_helper.rb', line 53 def (is_string) && (RegexpLib. =~ @outline_fragment) end |
#indicates_navigator ⇒ Object
58 59 60 |
# File 'lib/muwu/helper/outline_helper.rb', line 58 def indicates_navigator (is_string) && (RegexpLib.outline_navigator =~ @outline_fragment) end |
#indicates_outline_fragment ⇒ Object
63 64 65 |
# File 'lib/muwu/helper/outline_helper.rb', line 63 def indicates_outline_fragment is_array end |
#indicates_subcontents ⇒ Object
68 69 70 |
# File 'lib/muwu/helper/outline_helper.rb', line 68 def indicates_subcontents indicates_subcontents_hash || indicates_subcontents_string end |
#indicates_subcontents_hash ⇒ Object
73 74 75 |
# 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 ⇒ Object
78 79 80 |
# File 'lib/muwu/helper/outline_helper.rb', line 78 def indicates_subcontents_string (is_string) && (RegexpLib.outline_subcontents =~ @outline_fragment) end |
#indicates_text ⇒ Object
83 84 85 |
# File 'lib/muwu/helper/outline_helper.rb', line 83 def indicates_text (is_hash) && (RegexpLib.outline_text =~ @outline_fragment.flatten[0]) end |
#indicates_title ⇒ Object
88 89 90 |
# File 'lib/muwu/helper/outline_helper.rb', line 88 def indicates_title indicates_title_hash || indicates_title_string end |
#indicates_title_hash ⇒ Object
93 94 95 |
# 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 ⇒ Object
98 99 100 |
# File 'lib/muwu/helper/outline_helper.rb', line 98 def indicates_title_string (is_string) && (RegexpLib.outline_title =~ @outline_fragment) end |
#is_array ⇒ Object
103 104 105 |
# File 'lib/muwu/helper/outline_helper.rb', line 103 def is_array Array === @outline_fragment end |
#is_hash ⇒ Object
108 109 110 |
# File 'lib/muwu/helper/outline_helper.rb', line 108 def is_hash Hash === @outline_fragment end |
#is_integer ⇒ Object
113 114 115 |
# File 'lib/muwu/helper/outline_helper.rb', line 113 def is_integer Integer === @outline_fragment end |
#is_string ⇒ Object
118 119 120 |
# File 'lib/muwu/helper/outline_helper.rb', line 118 def is_string String === @outline_fragment end |
#text_step_flexible_suggests_file ⇒ Object
123 124 125 126 127 128 129 130 131 |
# 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 |