Class: Kaisoku::Selection

Inherits:
Struct
  • Object
show all
Defined in:
lib/kaisoku/selection.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason:, entities: [], safe: true, fallback: false, invalidate_map: false, warnings: [], ignored_files: []) ⇒ Selection

Returns a new instance of Selection.



14
15
16
17
18
19
20
21
22
23
# File 'lib/kaisoku/selection.rb', line 14

def initialize(
  reason:, entities: [],
  safe: true,
  fallback: false,
  invalidate_map: false,
  warnings: [],
  ignored_files: []
)
  super
end

Instance Attribute Details

#entitiesObject

Returns the value of attribute entities

Returns:

  • (Object)

    the current value of entities



4
5
6
# File 'lib/kaisoku/selection.rb', line 4

def entities
  @entities
end

#fallbackObject

Returns the value of attribute fallback

Returns:

  • (Object)

    the current value of fallback



4
5
6
# File 'lib/kaisoku/selection.rb', line 4

def fallback
  @fallback
end

#ignored_filesObject

Returns the value of attribute ignored_files

Returns:

  • (Object)

    the current value of ignored_files



4
5
6
# File 'lib/kaisoku/selection.rb', line 4

def ignored_files
  @ignored_files
end

#invalidate_mapObject

Returns the value of attribute invalidate_map

Returns:

  • (Object)

    the current value of invalidate_map



4
5
6
# File 'lib/kaisoku/selection.rb', line 4

def invalidate_map
  @invalidate_map
end

#reasonObject

Returns the value of attribute reason

Returns:

  • (Object)

    the current value of reason



4
5
6
# File 'lib/kaisoku/selection.rb', line 4

def reason
  @reason
end

#safeObject

Returns the value of attribute safe

Returns:

  • (Object)

    the current value of safe



4
5
6
# File 'lib/kaisoku/selection.rb', line 4

def safe
  @safe
end

#warningsObject

Returns the value of attribute warnings

Returns:

  • (Object)

    the current value of warnings



4
5
6
# File 'lib/kaisoku/selection.rb', line 4

def warnings
  @warnings
end

Class Method Details

.all(entities:, reason:, invalidate_map: false, warnings: []) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/kaisoku/selection.rb', line 29

def self.all(entities:, reason:, invalidate_map: false, warnings: [])
  new(
    entities: entities,
    fallback: true,
    invalidate_map: invalidate_map,
    reason: reason,
    warnings: warnings
  )
end

.none(ignored_files: [], reason: 'checksums unchanged') ⇒ Object



25
26
27
# File 'lib/kaisoku/selection.rb', line 25

def self.none(ignored_files: [], reason: 'checksums unchanged')
  new(entities: [], reason: reason, ignored_files: ignored_files)
end

Instance Method Details

#countObject



39
40
41
# File 'lib/kaisoku/selection.rb', line 39

def count
  entities.length
end

#fallback?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/kaisoku/selection.rb', line 47

def fallback?
  fallback
end

#safe?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/kaisoku/selection.rb', line 43

def safe?
  safe
end