class Forme::Input
High level abstract tag form, transformed by formatters into the lower level Tag
form (or an array of them).
Attributes
form[R]
The Form
object related to the receiver.
form_opts[R]
The options hash in use by the form at the time of the Input’s instantiation.
opts[R]
The options hash for the Input
.
type[R]
The type of input, should be a symbol (e.g. :submit, :text, :select).
Public Class Methods
new(form, type, opts={})
click to toggle source
Set the form
, type
, and opts
.
# File lib/forme/input.rb 20 def initialize(form, type, opts={}) 21 @form, @type = form, type 22 defaults = form.input_defaults 23 @opts = (defaults.fetch(type){defaults[type.to_s]} || {}).merge(opts) 24 @form_opts = form.opts 25 end
Public Instance Methods
format()
click to toggle source
Transform the receiver into a lower level Tag
form (or an array of them).
# File lib/forme/input.rb 40 def format 41 Forme.transform(:formatter, @opts, @form_opts, self) 42 end
tag(*a, &block)
click to toggle source
Create a new Tag
instance with the given arguments and block related to the receiver’s form
.
# File lib/forme/input.rb 29 def tag(*a, &block) 30 form._tag(*a, &block) 31 end
to_s()
click to toggle source
Return a string containing the serialized content of the receiver.
# File lib/forme/input.rb 34 def to_s 35 Forme.transform(:serializer, @opts, @form_opts, self) 36 end