Module: Rtml::Links
- Defined in:
- lib/rtml/links.rb
Instance Method Summary collapse
-
#id_for(str_or_sym) ⇒ Object
str_or_sym is the string or symbol to find id_ref is a boolean: if true, then # is prepended where necessary.
- #local?(str_or_sym) ⇒ Boolean
Instance Method Details
#id_for(str_or_sym) ⇒ Object
str_or_sym is the string or symbol to find id_ref is a boolean: if true, then # is prepended where necessary
4 5 6 7 8 9 10 11 12 |
# File 'lib/rtml/links.rb', line 4 def id_for(str_or_sym) tml_id = Rtml::Dom::Element.find_or_create_tml_id(str_or_sym) if local?(tml_id) "##{tml_id}" else tml_id end end |
#local?(str_or_sym) ⇒ Boolean
14 15 16 |
# File 'lib/rtml/links.rb', line 14 def local?(str_or_sym) !(str_or_sym.kind_of?(String) && (str_or_sym =~ /\// || str_or_sym =~ /#/ || str_or_sym =~ /:/) || str_or_sym.blank?) end |