lib/datanauts/form_helper/core_ext.rb
# :div.wrap "Hello", :id => "userbox", :class => "box"
# :div.wrap(:id => "userbox", :class => "box"){ "Hello" }
#
# If you give a content as block and as parameter too, then the parameter
# will be the default value (in case of the block is empty)


If you give a content as block and as parameter too, then the parameter
will be the default value (in case of the block is empty)
If you give a content as block and as parameter too then the parameter will be the default value ( in case of the block is empty )
def wrap(content = nil, options = {}, &block)
    if content.is_a? Hash
      options = content
      content = nil
    end
    content = yield || content if block
    "<#{self} #{options.to_html_options}>#{content}</#{self}>"
  end
def wrap ( content = nil , options = { } , & block ) if content . is_a? Hash options = content content = nil end content = yield || content if block "<#{self} #{options.to_html_options}>#{content}</#{self}>" end
:div.wrap "Hello", :id => "userbox", :class => "box"
:div.wrap(:id => "userbox", :class => "box"){ "Hello" }
: div . wrap " Hello " : id = > " userbox " : class = > " box " : div . wrap ( : id = > " userbox " : class = > " box " ) { " Hello " }
content
options
block