Class: MasterView::Directives::Block
- Inherits:
-
MasterView::DirectiveBase
- Object
- MasterView::DirectiveBase
- MasterView::Directives::Block
- Defined in:
- lib/masterview/directives/block.rb
Overview
outputs a block around the text tags, if left bracket count is higher than right assume that the end is a right bracket otherwise use end
Constant Summary
Constants included from MasterView::DirectiveHelpers
MasterView::DirectiveHelpers::CRLF, MasterView::DirectiveHelpers::ERB_END, MasterView::DirectiveHelpers::ERB_EVAL, MasterView::DirectiveHelpers::ERB_START
Instance Method Summary collapse
Methods inherited from MasterView::DirectiveBase
#append_to_attr_value!, #attr_lckv_matches, #attr_value, #attr_value=, #attrs, #attrs=, #attrs_lck, #attrs_lckv, #common_html_options, #content, #content=, #content_str, #data, #data=, #erb, #erb_content, full_attr_name, #initialize, #merge_hash_attr_value!, #parse_attr_value, #prepend_to_attr_value!, #quote, register_directive, #remove_strings_from_attr_value!, #save_directive_call_stack, #tag_name, #tag_name=
Methods included from MasterView::DirectiveHelpers
#delete_last_in_parent, #find_last_in_parent, #find_string_val_in_string_hash, #lowercase_attribute_keys, #lowercase_attribute_keys_and_values, #merge_into_embedded_hash, #parse, #parse_eval_into_array, #parse_eval_into_hash, #remove_prepended_strings
Methods included from PluginLoadTracking
Constructor Details
This class inherits a constructor from MasterView::DirectiveBase
Instance Method Details
#etag(directive_call_stack) ⇒ Object
21 22 23 24 25 |
# File 'lib/masterview/directives/block.rb', line 21 def etag(directive_call_stack) ret = [] ret << directive_call_stack.render ret << erb(@end_block) end |
#priority ⇒ Object
7 8 9 |
# File 'lib/masterview/directives/block.rb', line 7 def priority DirectivePriorities::MediumHigh end |
#stag(directive_call_stack) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/masterview/directives/block.rb', line 11 def stag(directive_call_stack) count_left_brackets = attr_value.scan( /\{/ ).size count_right_brackets = attr_value.scan( /\}/ ).size @end_block = (count_left_brackets > count_right_brackets) ? '}' : 'end' ret = [] ret << erb(attr_value) ret << directive_call_stack.render end |