Sha256: edf972f8ba488cdd22f7049f248cc5f61adc8b2b7f95586176d3a2af21c5d93b

Contents?: true

Size: 432 Bytes

Versions: 2

Compression:

Stored size: 432 Bytes

Contents

module Avo
  module Fields
    module FieldExtensions
      module HasFieldName
        # Set the field name
        def field_name(name)
          self.field_name_attribute = name
        end

        # Get the field name
        def get_field_name
          return self.field_name_attribute if self.field_name_attribute.present?

          self.to_s.demodulize.underscore.gsub '_field', ''
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
avo-0.5.0.beta9 lib/avo/fields/field_extensions/has_field_name.rb
avo-0.5.0.beta8 lib/avo/fields/field_extensions/has_field_name.rb