Module: Formular::Element::Modules::Container::InstanceMethods

Defined in:
lib/formular/element/modules/container.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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

Delegate missing methods to the builder

TODO

@apotonick is going to do something fancy here to delegate

the builder methods rather then using this method missing.



51
52
53
54
55
# File 'lib/formular/element/modules/container.rb', line 51

def method_missing(method, *args, &block)
  return super unless builder

  builder.send(method, *args, &block)
end

Instance Method Details

#contentObject



32
33
34
# File 'lib/formular/element/modules/container.rb', line 32

def content
  @block ? HtmlBlock.new(self, @block).call : options[:content].to_s
end

#endObject



40
41
42
# File 'lib/formular/element/modules/container.rb', line 40

def end
  to_html(context: :end)
end

#has_content?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/formular/element/modules/container.rb', line 36

def has_content?
  @block || options[:content]
end

#startObject



44
45
46
# File 'lib/formular/element/modules/container.rb', line 44

def start
  to_html(context: :start)
end