Class: Configural::Platform

Inherits:
Object
  • Object
show all
Defined in:
lib/configural/platform.rb

Direct Known Subclasses

LinuxPlatform, MacPlatform, WindowsPlatform

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Platform

Returns a new instance of Platform.



55
56
57
# File 'lib/configural/platform.rb', line 55

def initialize( app )
  @app = app
end

Class Method Details

.get_platform(app) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'lib/configural/platform.rb', line 40

def self.get_platform( app )
  platform = @subclasses.reverse.find { |subclass|
    subclass.match?( app )
  }
  unless platform
    raise 'Sorry, your operating system is not yet supported.'
  end
  platform
end

.inherited(subclass) ⇒ Object



35
36
37
38
# File 'lib/configural/platform.rb', line 35

def self.inherited(subclass)
  @subclasses ||= []
  @subclasses << subclass
end

.match?(app) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/configural/platform.rb', line 50

def self.match?( app )
  raise 'Method not implemented for base class.'
end

Instance Method Details

#cache_pathObject



59
60
61
# File 'lib/configural/platform.rb', line 59

def cache_path
  raise 'Method not implemented for base class.'
end

#config_pathObject



63
64
65
# File 'lib/configural/platform.rb', line 63

def config_path
  raise 'Method not implemented for base class.'
end

#data_pathObject



67
68
69
# File 'lib/configural/platform.rb', line 67

def data_path
  raise 'Method not implemented for base class.'
end