Module: Sudojs::Generators::Helpers
- Included in:
- ClassGenerator
- Defined in:
- lib/generators/sudojs/helpers.rb
Constant Summary collapse
- CFG =
YAML.load_file('config/sudo_js.yml')
Instance Method Summary collapse
- #camelize(what) ⇒ Object
- #css_extension ⇒ Object
- #html_extension ⇒ Object
- #js_extension ⇒ Object
- #namespace ⇒ Object
- #pascalize(what) ⇒ Object
-
#skip_css? ⇒ Boolean
do not create any files for (s)css.
- #which_sudo ⇒ Object
Instance Method Details
#camelize(what) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/generators/sudojs/helpers.rb', line 34 def camelize(what) if what.include? '_' ary = what.split '_' ary.each_with_index {|val, i| val.capitalize! if i > 0 } ary.join('') else what end end |
#css_extension ⇒ Object
30 31 32 |
# File 'lib/generators/sudojs/helpers.rb', line 30 def css_extension CFG['css_extension'] end |
#html_extension ⇒ Object
17 18 19 |
# File 'lib/generators/sudojs/helpers.rb', line 17 def html_extension CFG['html_extension'] end |
#js_extension ⇒ Object
21 22 23 |
# File 'lib/generators/sudojs/helpers.rb', line 21 def js_extension CFG['js_extension'] end |
#namespace ⇒ Object
9 10 11 |
# File 'lib/generators/sudojs/helpers.rb', line 9 def namespace CFG['js_namespace'] end |
#pascalize(what) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/generators/sudojs/helpers.rb', line 46 def pascalize(what) # wow, capitalize will downcase a camel-cased word - fail if what.include? '_' ary = what.split '_' ary.each {|val| val.capitalize! } ary.join('') else what.capitalize end end |
#skip_css? ⇒ Boolean
do not create any files for (s)css
26 27 28 |
# File 'lib/generators/sudojs/helpers.rb', line 26 def skip_css? CFG['skip_css'] end |
#which_sudo ⇒ Object
13 14 15 |
# File 'lib/generators/sudojs/helpers.rb', line 13 def which_sudo CFG['which_sudo'] end |