Module: Docp::TableHeaderPtn
- Included in:
- TableHeader, Docp::TableHeader::Column
- Defined in:
- lib/docp/table_header_ptn.rb
Instance Attribute Summary collapse
-
#after_check_val ⇒ Object
Returns the value of attribute after_check_val.
-
#exclude_ptn ⇒ Object
Returns the value of attribute exclude_ptn.
-
#include_ptn ⇒ Object
Returns the value of attribute include_ptn.
Instance Method Summary collapse
- #check_ptn(elem, ptn) ⇒ Object
- #exclude_ptn?(node) ⇒ Boolean
- #include_ptn?(node) ⇒ Boolean
- #ptn?(elems, ptn) ⇒ Boolean
Instance Attribute Details
#after_check_val ⇒ Object
Returns the value of attribute after_check_val.
4 5 6 |
# File 'lib/docp/table_header_ptn.rb', line 4 def after_check_val @after_check_val end |
#exclude_ptn ⇒ Object
Returns the value of attribute exclude_ptn.
3 4 5 |
# File 'lib/docp/table_header_ptn.rb', line 3 def exclude_ptn @exclude_ptn end |
#include_ptn ⇒ Object
Returns the value of attribute include_ptn.
3 4 5 |
# File 'lib/docp/table_header_ptn.rb', line 3 def include_ptn @include_ptn end |
Instance Method Details
#check_ptn(elem, ptn) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/docp/table_header_ptn.rb', line 5 def check_ptn elem, ptn text = after_check_val ? after_check_val.call(elem) : elem.text.del_space if ptn.is_a?(Regexp) text =~ ptn else [ptn].flatten.find {|v| if v.is_a?(Regexp) text =~ v else text == v end } end end |
#exclude_ptn?(node) ⇒ Boolean
24 25 26 |
# File 'lib/docp/table_header_ptn.rb', line 24 def exclude_ptn? node ptn?(node, @exclude_ptn) if @exclude_ptn end |
#include_ptn?(node) ⇒ Boolean
28 29 30 |
# File 'lib/docp/table_header_ptn.rb', line 28 def include_ptn? node ptn?(node, @include_ptn) end |
#ptn?(elems, ptn) ⇒ Boolean
20 21 22 |
# File 'lib/docp/table_header_ptn.rb', line 20 def ptn? elems, ptn [elems].flatten.find {|el| check_ptn(el, ptn) } end |