Module: Stastic::Config
Constant Summary collapse
- VALID_SETTINGS =
%w(user token name site_id site_root host)
Instance Method Summary collapse
- #credentials? ⇒ Boolean
- #exists? ⇒ Boolean
- #reset ⇒ Object
- #site_defined? ⇒ Boolean
- #update(attrs, scope = nil) ⇒ Object (also: #add)
Instance Method Details
#credentials? ⇒ Boolean
12 13 14 |
# File 'lib/stastic/config.rb', line 12 def credentials? exists? && user && token end |
#exists? ⇒ Boolean
8 9 10 |
# File 'lib/stastic/config.rb', line 8 def exists? File.exists?(config_path) || File.exists?(global_path) end |
#reset ⇒ Object
30 31 32 33 |
# File 'lib/stastic/config.rb', line 30 def reset @config = nil @global_config = nil end |
#site_defined? ⇒ Boolean
16 17 18 |
# File 'lib/stastic/config.rb', line 16 def site_defined? credentials? && site_id end |
#update(attrs, scope = nil) ⇒ Object Also known as: add
20 21 22 23 24 25 26 |
# File 'lib/stastic/config.rb', line 20 def update(attrs, scope = nil) if scope == :global @global_config = update_config(attrs, global_config, global_path) else @config = update_config(attrs, config, config_path) end end |