Class: Rosette::Queuing::Commits::CommitsQueueConfigurator

Inherits:
Object
  • Object
show all
Defined in:
lib/rosette/queuing/commits/commits_queue_configurator.rb

Overview

Configuration specific to the “commits” queue that processes commits.

Constant Summary collapse

DEFAULT_DIFF_POINT =
'master'
DEFAULT_PHRASE_GRANULARITY =
PhraseStorageGranularity::COMMIT

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ CommitsQueueConfigurator

Creates a new configurator and sets up a few defaults.

Parameters:

  • name (String)

    The name of the queue.


31
32
33
34
35
# File 'lib/rosette/queuing/commits/commits_queue_configurator.rb', line 31

def initialize(name)
  @name = name
  @diff_point = DEFAULT_DIFF_POINT
  @phrase_storage_granularity = DEFAULT_PHRASE_GRANULARITY
end

Instance Attribute Details

#diff_pointString (readonly)

Returns the diff point to use when computing phrase diffs. Defaults to “master”. Used only when phrase_storage_granularity is set to [Rosette::Queuing::Commits::PhraseStorageGranularity::BRANCH].

Returns:

  • (String)

    the diff point to use when computing phrase diffs. Defaults to “master”. Used only when phrase_storage_granularity is set to [Rosette::Queuing::Commits::PhraseStorageGranularity::BRANCH].


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/rosette/queuing/commits/commits_queue_configurator.rb', line 21

class CommitsQueueConfigurator
  DEFAULT_DIFF_POINT = 'master'
  DEFAULT_PHRASE_GRANULARITY = PhraseStorageGranularity::COMMIT

  attr_reader :name, :diff_point, :phrase_storage_granularity

  # Creates a new configurator and sets up a few defaults.
  #
  # @param [String] name The name of the queue.
  # @return [CommitsQueueConfigurator]
  def initialize(name)
    @name = name
    @diff_point = DEFAULT_DIFF_POINT
    @phrase_storage_granularity = DEFAULT_PHRASE_GRANULARITY
  end

  # Sets the phrase storage granularity, i.e. the method used to determine
  # which set of phrases should get uploaded to the TMS.
  #
  # @param [String] granularity One of the constant values in
  #   [Rosette::Queuing::Commits::PhraseStorageGranularity].
  # @return [void]
  def set_phrase_storage_granularity(granularity)
    @phrase_storage_granularity = granularity
  end

  # Sets the diff point to use when computing phrase diffs. Note that this
  # value is only important when +phrase_storage_granularity+ is set to
  # [Rosette::Queuing::Commits::PhraseStorageGranularity::BRANCH].
  #
  # @param [String] new_diff_point The diff point to set.
  # @return [void]
  def set_diff_point(new_diff_point)
    @diff_point = new_diff_point
  end
end

#nameString (readonly)

Returns:

  • (String)

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/rosette/queuing/commits/commits_queue_configurator.rb', line 21

class CommitsQueueConfigurator
  DEFAULT_DIFF_POINT = 'master'
  DEFAULT_PHRASE_GRANULARITY = PhraseStorageGranularity::COMMIT

  attr_reader :name, :diff_point, :phrase_storage_granularity

  # Creates a new configurator and sets up a few defaults.
  #
  # @param [String] name The name of the queue.
  # @return [CommitsQueueConfigurator]
  def initialize(name)
    @name = name
    @diff_point = DEFAULT_DIFF_POINT
    @phrase_storage_granularity = DEFAULT_PHRASE_GRANULARITY
  end

  # Sets the phrase storage granularity, i.e. the method used to determine
  # which set of phrases should get uploaded to the TMS.
  #
  # @param [String] granularity One of the constant values in
  #   [Rosette::Queuing::Commits::PhraseStorageGranularity].
  # @return [void]
  def set_phrase_storage_granularity(granularity)
    @phrase_storage_granularity = granularity
  end

  # Sets the diff point to use when computing phrase diffs. Note that this
  # value is only important when +phrase_storage_granularity+ is set to
  # [Rosette::Queuing::Commits::PhraseStorageGranularity::BRANCH].
  #
  # @param [String] new_diff_point The diff point to set.
  # @return [void]
  def set_diff_point(new_diff_point)
    @diff_point = new_diff_point
  end
end

#phrase_storage_granularityString (readonly)

Returns determines which set of phrases to push to the TMS. Must be one of the constant values in [Rosette::Queuing::Commits::PhraseStorageGranularity].

Returns:

  • (String)

    determines which set of phrases to push to the TMS. Must be one of the constant values in

    Rosette::Queuing::Commits::PhraseStorageGranularity

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/rosette/queuing/commits/commits_queue_configurator.rb', line 21

class CommitsQueueConfigurator
  DEFAULT_DIFF_POINT = 'master'
  DEFAULT_PHRASE_GRANULARITY = PhraseStorageGranularity::COMMIT

  attr_reader :name, :diff_point, :phrase_storage_granularity

  # Creates a new configurator and sets up a few defaults.
  #
  # @param [String] name The name of the queue.
  # @return [CommitsQueueConfigurator]
  def initialize(name)
    @name = name
    @diff_point = DEFAULT_DIFF_POINT
    @phrase_storage_granularity = DEFAULT_PHRASE_GRANULARITY
  end

  # Sets the phrase storage granularity, i.e. the method used to determine
  # which set of phrases should get uploaded to the TMS.
  #
  # @param [String] granularity One of the constant values in
  #   [Rosette::Queuing::Commits::PhraseStorageGranularity].
  # @return [void]
  def set_phrase_storage_granularity(granularity)
    @phrase_storage_granularity = granularity
  end

  # Sets the diff point to use when computing phrase diffs. Note that this
  # value is only important when +phrase_storage_granularity+ is set to
  # [Rosette::Queuing::Commits::PhraseStorageGranularity::BRANCH].
  #
  # @param [String] new_diff_point The diff point to set.
  # @return [void]
  def set_diff_point(new_diff_point)
    @diff_point = new_diff_point
  end
end

Instance Method Details

#set_diff_point(new_diff_point) ⇒ void

This method returns an undefined value.

Sets the diff point to use when computing phrase diffs. Note that this value is only important when phrase_storage_granularity is set to [Rosette::Queuing::Commits::PhraseStorageGranularity::BRANCH].

Parameters:

  • new_diff_point (String)

    The diff point to set.


53
54
55
# File 'lib/rosette/queuing/commits/commits_queue_configurator.rb', line 53

def set_diff_point(new_diff_point)
  @diff_point = new_diff_point
end

#set_phrase_storage_granularity(granularity) ⇒ void

This method returns an undefined value.

Sets the phrase storage granularity, i.e. the method used to determine which set of phrases should get uploaded to the TMS.

Parameters:

  • granularity (String)

    One of the constant values in [Rosette::Queuing::Commits::PhraseStorageGranularity].


43
44
45
# File 'lib/rosette/queuing/commits/commits_queue_configurator.rb', line 43

def set_phrase_storage_granularity(granularity)
  @phrase_storage_granularity = granularity
end