Module: Kwatable::RubyHelper
- Defined in:
- lib/kwatable/template/helper/ruby.rb
Constant Summary collapse
- @@ruby_keyword_table =
ruby_keywords().inject({}) { |h, w| h[w] = true; h }
Class Method Summary collapse
-
.ruby_keywords ⇒ Object
ruby keywords.
Instance Method Summary collapse
-
#escape_ruby_keyword(word) ⇒ Object
escape ruby keywords.
Class Method Details
.ruby_keywords ⇒ Object
ruby keywords
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kwatable/template/helper/ruby.rb', line 13 def self.ruby_keywords() keywords = <<-END BEGIN END alias and begin break case class def defined do else elsif end ensure false for if in module next nil not or redo rescue retry return self super then true undef unless until when while yield END return keywords.split(/\s+/) end |
Instance Method Details
#escape_ruby_keyword(word) ⇒ Object
escape ruby keywords
29 30 31 |
# File 'lib/kwatable/template/helper/ruby.rb', line 29 def escape_ruby_keyword(word) return @@ruby_keyword_table[word] ? "_#{word}" : word end |