Class: TypesFromSerializers::Changes

Inherits:
Object
  • Object
show all
Defined in:
lib/types_from_serializers/generator.rb

Overview

Internal: Structure to keep track of changed files.

Instance Method Summary collapse

Constructor Details

#initialize(dirs) ⇒ Changes

Returns a new instance of Changes.



151
152
153
154
155
156
# File 'lib/types_from_serializers/generator.rb', line 151

def initialize(dirs)
  @added = Set.new
  @removed = Set.new
  @modified = Set.new
  track_changes(dirs)
end

Instance Method Details

#any_removed?Boolean

Returns:

  • (Boolean)


162
163
164
# File 'lib/types_from_serializers/generator.rb', line 162

def any_removed?
  @removed.any?
end

#clearObject



174
175
176
177
178
# File 'lib/types_from_serializers/generator.rb', line 174

def clear
  @added.clear
  @removed.clear
  @modified.clear
end

#modified_filesObject



166
167
168
# File 'lib/types_from_serializers/generator.rb', line 166

def modified_files
  @modified
end

#only_modified?Boolean

Returns:

  • (Boolean)


170
171
172
# File 'lib/types_from_serializers/generator.rb', line 170

def only_modified?
  @added.empty? && @removed.empty?
end

#updated?Boolean

Returns:

  • (Boolean)


158
159
160
# File 'lib/types_from_serializers/generator.rb', line 158

def updated?
  @modified.any? || @added.any? || @removed.any?
end