Class: Configural::App

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ App

Returns a new instance of App.



38
39
40
41
# File 'lib/configural/app.rb', line 38

def initialize( name )
  @name = name
  @user = Configural::User.new(self)
end

Instance Attribute Details

#cache_pathObject



54
55
56
# File 'lib/configural/app.rb', line 54

def cache_path
  @cache_path || (@path and File.join(@path, 'cache'))
end

#config_pathObject



69
70
71
# File 'lib/configural/app.rb', line 69

def config_path
  @config_path || (@path and File.join(@path, 'config'))
end

#data_pathObject



84
85
86
# File 'lib/configural/app.rb', line 84

def data_path
  @data_path || (@path and File.join(@path, 'data'))
end

#nameObject

Returns the value of attribute name.



34
35
36
# File 'lib/configural/app.rb', line 34

def name
  @name
end

#pathObject

Returns the value of attribute path.



34
35
36
# File 'lib/configural/app.rb', line 34

def path
  @path
end

#userObject (readonly)

Returns the value of attribute user.



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

def user
  @user
end

Instance Method Details

#cacheObject



44
45
46
47
48
49
50
51
52
# File 'lib/configural/app.rb', line 44

def cache
  @cache ||=
    begin
      unless @cache_path
        raise 'you must set cache_path or path first'
      end
      Configural::Cache.new(self)
    end
end

#configObject



59
60
61
62
63
64
65
66
67
# File 'lib/configural/app.rb', line 59

def config
  @config ||=
    begin
      unless @config_path
        raise 'you must set config_path or path first'
      end
      Configural::Config.new(self)
    end
end

#dataObject



74
75
76
77
78
79
80
81
82
# File 'lib/configural/app.rb', line 74

def data
  @data ||=
    begin
      unless @data_path
        raise 'you must set data_path or path first'
      end
      Configural::Data.new(self)
    end
end

#save_allObject



89
90
91
92
93
# File 'lib/configural/app.rb', line 89

def save_all
  @config.save_all if @config
  @user.save_all if @user
  self
end