Class: LittleWeasel::Metadata::InvalidWordsServiceResults

Inherits:
Object
  • Object
show all
Defined in:
lib/LittleWeasel/metadata/invalid_words_service_results.rb

Overview

This class provides a container for the results of the InvalidWordsService service.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(max_invalid_words_bytesize_on:, current_invalid_word_bytesize:, max_invalid_words_bytesize:) ⇒ InvalidWordsServiceResults

Returns a new instance of InvalidWordsServiceResults.



11
12
13
14
15
16
17
# File 'lib/LittleWeasel/metadata/invalid_words_service_results.rb', line 11

def initialize(max_invalid_words_bytesize_on:,
  current_invalid_word_bytesize:, max_invalid_words_bytesize:)

  self.max_invalid_words_bytesize_on = max_invalid_words_bytesize_on
  self.current_invalid_word_bytesize = current_invalid_word_bytesize
  self.max_invalid_words_bytesize = max_invalid_words_bytesize
end

Instance Attribute Details

#current_invalid_word_bytesizeObject

Returns the value of attribute current_invalid_word_bytesize.



8
9
10
# File 'lib/LittleWeasel/metadata/invalid_words_service_results.rb', line 8

def current_invalid_word_bytesize
  @current_invalid_word_bytesize
end

#max_invalid_words_bytesizeObject

Returns the value of attribute max_invalid_words_bytesize.



9
10
11
# File 'lib/LittleWeasel/metadata/invalid_words_service_results.rb', line 9

def max_invalid_words_bytesize
  @max_invalid_words_bytesize
end

#max_invalid_words_bytesize_onObject (private)

Returns the value of attribute max_invalid_words_bytesize_on.



41
42
43
# File 'lib/LittleWeasel/metadata/invalid_words_service_results.rb', line 41

def max_invalid_words_bytesize_on
  @max_invalid_words_bytesize_on
end

Instance Method Details

#cache_invalid_words?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/LittleWeasel/metadata/invalid_words_service_results.rb', line 35

def cache_invalid_words?
  on? && !value_exceeded?
end

#off?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/LittleWeasel/metadata/invalid_words_service_results.rb', line 23

def off?
  !on?
end

#on?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/LittleWeasel/metadata/invalid_words_service_results.rb', line 19

def on?
  max_invalid_words_bytesize_on
end

#valueObject



27
28
29
# File 'lib/LittleWeasel/metadata/invalid_words_service_results.rb', line 27

def value
  max_invalid_words_bytesize
end

#value_exceeded?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/LittleWeasel/metadata/invalid_words_service_results.rb', line 31

def value_exceeded?
  on? && current_invalid_word_bytesize > max_invalid_words_bytesize
end