Sha256: 5064a3dd3b952313e1c84e1d757380c83ca5c8666758bc7eafea013d3123c59b
Contents?: true
Size: 1.56 KB
Versions: 42
Compression:
Stored size: 1.56 KB
Contents
module Ecoportal module API class V2 class Page class Component class TagField < Page::Component passboolean :single_select, :use_defaults passthrough :tag_tree_id, :button_text def to_s(delimiter: "\n") root.tags.to_s(delimiter: delimiter) end # Quick config helper # @param conf [Symbol, Array<Symbol>] # - `:multiple` to allow multiple selection # - `:single` to set to singular selection # - `:default_tag` to prepopulate using users's `default_tag` # - `:button_text` to define the button description def configure(*conf) conf.each_with_object([]) do |cnf, unused| case cnf when :single self.single_select = true when :multiple self.single_select = false when :default_tag self.use_defaults = true when Hash supported = [:button_text] unless (rest = hash_except(cnf.dup, *supported)).empty? unused.push(rest) end if cnf.key?(:button_text) then self.button_text = cnf[:button_text] end else unused.push(cnf) end end.yield_self do |unused| super(*unused) end end end end end end end end
Version data entries
42 entries across 42 versions & 1 rubygems