Class: DiscourseTheme::Config::PathSetting

Inherits:
Object
  • Object
show all
Defined in:
lib/discourse_theme/config.rb

Instance Method Summary collapse

Constructor Details

#initialize(config, path) ⇒ PathSetting

Returns a new instance of PathSetting.



4
5
6
7
# File 'lib/discourse_theme/config.rb', line 4

def initialize(config, path)
  @config = config
  @path = path
end

Instance Method Details

#api_keyObject



9
10
11
# File 'lib/discourse_theme/config.rb', line 9

def api_key
  search_api_key(url) || safe_config["api_key"]
end

#api_key=(val) ⇒ Object



13
14
15
# File 'lib/discourse_theme/config.rb', line 13

def api_key=(val)
  set_api_key(url, val)
end

#componentsObject



40
41
42
# File 'lib/discourse_theme/config.rb', line 40

def components
  safe_config["components"]
end

#components=(val) ⇒ Object



44
45
46
# File 'lib/discourse_theme/config.rb', line 44

def components=(val)
  set("components", val)
end

#local_discourse_directoryObject



52
53
54
# File 'lib/discourse_theme/config.rb', line 52

def local_discourse_directory
  safe_config["local_discourse_directory"]
end

#local_discourse_directory=(dir) ⇒ Object



56
57
58
# File 'lib/discourse_theme/config.rb', line 56

def local_discourse_directory=(dir)
  set("local_discourse_directory", dir)
end

#local_discourse_directory_configured?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/discourse_theme/config.rb', line 48

def local_discourse_directory_configured?
  !safe_config["local_discourse_directory"].nil?
end

#possible_urlObject



25
26
27
28
29
30
# File 'lib/discourse_theme/config.rb', line 25

def possible_url
  return safe_config["url"] if safe_config["url"]

  first_config = @config.raw_config.values.find { |config| config["url"] }
  first_config["url"] if first_config
end

#theme_idObject



32
33
34
# File 'lib/discourse_theme/config.rb', line 32

def theme_id
  safe_config["theme_id"].to_i
end

#theme_id=(theme_id) ⇒ Object



36
37
38
# File 'lib/discourse_theme/config.rb', line 36

def theme_id=(theme_id)
  set("theme_id", theme_id.to_i)
end

#urlObject



17
18
19
# File 'lib/discourse_theme/config.rb', line 17

def url
  safe_config["url"]
end

#url=(val) ⇒ Object



21
22
23
# File 'lib/discourse_theme/config.rb', line 21

def url=(val)
  set("url", val)
end