class GatherContent::Config::Element::Text
Attributes
limit[RW]
limit_type[RW]
plain_text[RW]
value[RW]
Public Class Methods
new(name = "", required = false, label = "", microcopy = "", value = "", limit_type = :chars, limit = 0, plain_text = true)
click to toggle source
Calls superclass method
GatherContent::Config::Element::Base::new
# File lib/gather_content/config/elements/text.rb, line 9 def initialize(name = "", required = false, label = "", microcopy = "", value = "", limit_type = :chars, limit = 0, plain_text = true) super(name, required, label, microcopy) @value = value @limit_type = limit_type @limit = limit @plain_text = plain_text end
Public Instance Methods
serialize(options = nil)
click to toggle source
Calls superclass method
GatherContent::Config::Element::Base#serialize
# File lib/gather_content/config/elements/text.rb, line 17 def serialize(options = nil) raise ArgumentError, "limit_type is can only be :words or :chars" unless [ :words, :chars ].include?(limit_type) raise ArgumentError, "limit be a positive number" if limit.to_i < 0 super.merge({ type: 'text', value: value, limit_type: limit_type.to_s, limit: limit.to_i, plain_text: !!plain_text }) end