Sha256: 8572cdfa00700c366c2c3927ee6e8d5118c78703248f55a763c002fd892dca03

Contents?: true

Size: 654 Bytes

Versions: 2

Compression:

Stored size: 654 Bytes

Contents

module Localtower
  module Generators
    module ServiceObjects
      class InsertNullable
        def initialize(attributes)
          @attributes = attributes
        end

        def call
          attributes.each do |attribute|
            line_str = Localtower::Tools.line_for_attribute(attribute)[0]
            if line_str.present?
              content = File.read(Localtower::Tools.last_migration_pending).gsub(line_str, "#{line_str}, null: false")
              File.write(Localtower::Tools.last_migration_pending, content)
            end
          end
        end

        private

        attr_reader :attributes
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
localtower-2.0.1 lib/localtower/generators/service_objects/insert_nullable.rb
localtower-2.0.0 lib/localtower/generators/service_objects/insert_nullable.rb