Sha256: d420f7bed7f97931c81ec0f0dd0305b9eb527cc33e4cf400d8e2163da81e1510
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
module Plutonium module Core module Fields module Inputs class Base attr_reader :name, :user_options def initialize(name, **user_options) @name = name @user_options = user_options end def render(f, record) raise NotImplementedError, "#{self.class}#render" end def collect(params) # Handles multi parameter attributes # https://www.cookieshq.co.uk/posts/rails-spelunking-date-select # https://www.cookieshq.co.uk/posts/multiparameter-attributes # Matches # - parameter # - parameter(1) # - parameter(2) # - parameter(1i) # - parameter(2f) regex = /^#{param}(\(\d+[if]?\))?$/ params.select { |key| regex.match? key } end protected def input_options = {} def param = name def options = @options ||= input_options.deep_merge(@user_options) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
plutonium-0.6.2 | lib/plutonium/core/fields/inputs/base.rb |
plutonium-0.6.1 | lib/plutonium/core/fields/inputs/base.rb |
plutonium-0.6.0 | lib/plutonium/core/fields/inputs/base.rb |