Sha256: 3602505e5a25fc778524157e898e2107a4546a19000f2bbf685c63d093d4ba06
Contents?: true
Size: 937 Bytes
Versions: 55
Compression:
Stored size: 937 Bytes
Contents
module Para module Generators module FieldHelpers private def attributes @attributes ||= begin model = namespaced_class_name.constantize AttributeFieldMappings.new(model).fields end end def field_options_for(field, options = {}) field_options = field.field_options.merge(options) options = field_options.each_with_object([]) do |(key, value), ary| if writable_value?(value) if key.to_s.match(/^[\w\d]+/) join_symbol = ': ' else join_symbol = ' => ' key = key.inspect end ary << [key, join_symbol, value.inspect].join end end ", #{ options.join(', ') }" if options.any? end def writable_value?(value) [String, Symbol].any? do |type| value.kind_of?(type) end end end end end
Version data entries
55 entries across 55 versions & 1 rubygems