Sha256: aafa283901cf5f1c3658ee7a1245b51fe7070f7177d4b0f72c89c473697f525a

Contents?: true

Size: 513 Bytes

Versions: 12

Compression:

Stored size: 513 Bytes

Contents

module HoboFields

  FieldsDeclaration = classy_module do

    def self.fields(&b)
      # Any model that calls 'fields' gets a bunch of other
      # functionality included automatically, but make sure we only include it once
      include HoboFields::ModelExtensions unless HoboFields::ModelExtensions.in?(included_modules)

      if b
        dsl = FieldDeclarationDsl.new(self)
        if b.arity == 1
          yield dsl
        else
          dsl.instance_eval(&b)
        end
      end
    end

  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hobofields-0.9.0 lib/hobo_fields/fields_declaration.rb
hobofields-0.8.10 lib/hobo_fields/fields_declaration.rb
hobofields-0.8.9 lib/hobo_fields/fields_declaration.rb
hobofields-0.8.8 lib/hobo_fields/fields_declaration.rb
hobofields-0.8.2 lib/hobo_fields/fields_declaration.rb
hobofields-0.8.3 lib/hobo_fields/fields_declaration.rb
hobofields-0.8.1 lib/hobo_fields/fields_declaration.rb
hobofields-0.8.4 lib/hobo_fields/fields_declaration.rb
hobofields-0.8 lib/hobo_fields/fields_declaration.rb
hobofields-0.8.6 lib/hobo_fields/fields_declaration.rb
hobofields-0.8.5 lib/hobo_fields/fields_declaration.rb
hobofields-0.8.7 lib/hobo_fields/fields_declaration.rb