File: configuration.rb

package info (click to toggle)
ruby-necromancer 0.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 308 kB
  • sloc: ruby: 1,578; sh: 4; makefile: 4
file content (46 lines) | stat: -rw-r--r-- 869 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
# frozen_string_literal: true

module Necromancer
  # A global configuration for converters.
  #
  # Used internally by {Necromancer::Context}.
  #
  # @api private
  class Configuration
    # Configure global strict mode
    #
    # @api public
    attr_writer :strict

    # Configure global copy mode
    #
    # @api public
    attr_writer :copy

    # Create a configuration
    #
    # @api private
    def initialize
      @strict = false
      @copy   = true
    end

    # Set or get strict mode
    #
    # @return [Boolean]
    #
    # @api public
    def strict(value = (not_set = true))
      not_set ? @strict : (self.strict = value)
    end

    # Set or get copy mode
    #
    # @return [Boolean]
    #
    # @api public
    def copy(value = (not_set = true))
      not_set ? @copy : (self.copy = value)
    end
  end # Configuration
end # Necromancer