Module: Rack::App::FrontEnd::Helpers::HtmlDsl

Defined in:
lib/rack/app/front_end/helpers/html_dsl.rb

Constant Summary collapse

UnImplementedError =
Class.new(StandardError)

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



20
21
22
23
24
# File 'lib/rack/app/front_end/helpers/html_dsl.rb', line 20

def method_missing(method_name,*args,&block)
  Rack::App::FrontEnd::Helpers::HtmlDsl.build(method_name,*args,&block)
rescue UnImplementedError
  super
end

Class Method Details

.build(method_name, *args, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rack/app/front_end/helpers/html_dsl.rb', line 7

def self.build(method_name, *args, &block)
  case method_name.to_s

    when /_tag$/
      tag_name = method_name.to_s.sub(/_tag$/, '')
      TagBuilder.build(tag_name,*args,&block)

    else
      raise(UnImplementedError)

  end
end

Instance Method Details

#form_tag(*args, &block) ⇒ Object



26
27
28
29
# File 'lib/rack/app/front_end/helpers/html_dsl.rb', line 26

def form_tag(*args, &block)
  args.unshift({'method' => "get", 'accept-charset' => "UTF-8"})
  super
end