Class: Uniword::WordImplementationFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/uniword/word_implementation_factory.rb

Overview

Separate factory class - follows Single Responsibility Principle

Class Method Summary collapse

Class Method Details

.createObject



6
7
8
9
10
11
12
13
# File 'lib/uniword/word_implementation_factory.rb', line 6

def self.create
  case RbConfig::CONFIG["host_os"]
  when /darwin/ then MacOSWordImplementation.new
  when /mswin|mingw|cygwin/ then WindowsWordImplementation.new
  when /linux/ then LinuxWordImplementation.new
  else NullWordImplementation.new
  end
end