Module: SinatraHelpers::Erb::Helpers
- Defined in:
- lib/sinatra_helpers/erb/helpers.rb
Instance Method Summary collapse
- #sinatra_erb_helper_capture(*args, &block) ⇒ Object
- #sinatra_erb_helper_checked_option ⇒ Object
- #sinatra_erb_helper_disabled_option ⇒ Object
- #sinatra_erb_helper_hash_to_html_attrs(a_hash) ⇒ Object
- #sinatra_erb_helper_multipart_option ⇒ Object
- #sinatra_erb_helper_multiple_option ⇒ Object
- #sinatra_erb_helper_safe_id(id) ⇒ Object
-
#sinatra_erb_helper_with_output_buffer(buf = '') ⇒ Object
:nodoc:.
Instance Method Details
#sinatra_erb_helper_capture(*args, &block) ⇒ Object
7 8 9 |
# File 'lib/sinatra_helpers/erb/helpers.rb', line 7 def sinatra_erb_helper_capture(*args, &block) sinatra_erb_helper_with_output_buffer { block.call(*args) } end |
#sinatra_erb_helper_checked_option ⇒ Object
27 28 29 |
# File 'lib/sinatra_helpers/erb/helpers.rb', line 27 def sinatra_erb_helper_checked_option 'checked' end |
#sinatra_erb_helper_disabled_option ⇒ Object
23 24 25 |
# File 'lib/sinatra_helpers/erb/helpers.rb', line 23 def sinatra_erb_helper_disabled_option 'disabled' end |
#sinatra_erb_helper_hash_to_html_attrs(a_hash) ⇒ Object
19 20 21 |
# File 'lib/sinatra_helpers/erb/helpers.rb', line 19 def sinatra_erb_helper_hash_to_html_attrs(a_hash) a_hash.collect{|key, val| "#{key}=\"#{val}\""}.join(' ') end |
#sinatra_erb_helper_multipart_option ⇒ Object
35 36 37 |
# File 'lib/sinatra_helpers/erb/helpers.rb', line 35 def sinatra_erb_helper_multipart_option 'multipart/form-data' end |
#sinatra_erb_helper_multiple_option ⇒ Object
31 32 33 |
# File 'lib/sinatra_helpers/erb/helpers.rb', line 31 def sinatra_erb_helper_multiple_option 'multiple' end |
#sinatra_erb_helper_safe_id(id) ⇒ Object
3 4 5 |
# File 'lib/sinatra_helpers/erb/helpers.rb', line 3 def sinatra_erb_helper_safe_id(id) id.gsub(/\W/,'') end |
#sinatra_erb_helper_with_output_buffer(buf = '') ⇒ Object
:nodoc:
11 12 13 14 15 16 17 |
# File 'lib/sinatra_helpers/erb/helpers.rb', line 11 def sinatra_erb_helper_with_output_buffer(buf = '') #:nodoc: @_out_buf, old_buffer = buf, @_out_buf yield @_out_buf ensure @_out_buf = old_buffer end |