Module: SetupConfiguration::Encoder

Included in:
Translation::Translator
Defined in:
lib/setup_configuration/encoding.rb

Constant Summary collapse

@@supported =
RUBY_VERSION > '1.9'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_encodingObject



13
14
15
# File 'lib/setup_configuration/encoding.rb', line 13

def self.default_encoding
  "windows-1252"
end

.encodingObject



17
18
19
# File 'lib/setup_configuration/encoding.rb', line 17

def self.encoding
  default_encoding
end

.encoding_supportedObject



9
10
11
# File 'lib/setup_configuration/encoding.rb', line 9

def self.encoding_supported
  @@supported
end

Instance Method Details

#force_encoding(text, encoding = Encoder.encoding) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/setup_configuration/encoding.rb', line 27

def force_encoding(text, encoding = Encoder.encoding)
  if @@supported
    text.force_encoding(encoding)
  else
    text
  end
end