Class: Uniword::WordImplementation

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

Overview

Abstract base class for Word implementation queries

This is a MODEL (not just a service). It has:

  • State: platform, version, installation status

  • Behavior: query paths, list resources

Does NOT extend Lutaml::Model::Serializable because it doesn’t need serialization.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.detectObject

Factory - delegates to platform-specific implementation



13
14
15
# File 'lib/uniword/word_implementation.rb', line 13

def self.detect
  WordImplementationFactory.create
end

Instance Method Details

#available_color_schemesObject



50
51
52
53
54
55
56
# File 'lib/uniword/word_implementation.rb', line 50

def available_color_schemes
  return [] unless color_schemes_path && File.directory?(color_schemes_path)

  Dir.glob(File.join(color_schemes_path, "*.xml")).map do |f|
    File.basename(f, ".xml")
  end
end

#available_font_schemesObject



58
59
60
61
62
63
64
# File 'lib/uniword/word_implementation.rb', line 58

def available_font_schemes
  return [] unless font_schemes_path && File.directory?(font_schemes_path)

  Dir.glob(File.join(font_schemes_path, "*.xml")).map do |f|
    File.basename(f, ".xml")
  end
end

#available_stylesetsObject



42
43
44
45
46
47
48
# File 'lib/uniword/word_implementation.rb', line 42

def available_stylesets
  return [] unless stylesets_path && File.directory?(stylesets_path)

  Dir.glob(File.join(stylesets_path, "*.dotx")).map do |f|
    File.basename(f, ".dotx")
  end
end

#available_themesObject

Resource enumeration - return empty array by default



34
35
36
37
38
39
40
# File 'lib/uniword/word_implementation.rb', line 34

def available_themes
  return [] unless themes_path && File.directory?(themes_path)

  Dir.glob(File.join(themes_path, "*.thmx")).map do |f|
    File.basename(f, ".thmx")
  end
end

#cache_pathObject



31
# File 'lib/uniword/word_implementation.rb', line 31

def cache_path; end

#color_schemes_pathObject



29
# File 'lib/uniword/word_implementation.rb', line 29

def color_schemes_path; end

#font_schemes_pathObject



30
# File 'lib/uniword/word_implementation.rb', line 30

def font_schemes_path; end

#installed?Boolean

Abstract methods - raise if not overridden

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/uniword/word_implementation.rb', line 18

def installed?
  raise NotImplementedError
end

#stylesets_pathObject



28
# File 'lib/uniword/word_implementation.rb', line 28

def stylesets_path; end

#themes_pathObject

Path accessors - return nil if not applicable



27
# File 'lib/uniword/word_implementation.rb', line 27

def themes_path; end

#versionObject

Raises:

  • (NotImplementedError)


22
23
24
# File 'lib/uniword/word_implementation.rb', line 22

def version
  raise NotImplementedError
end