Class: CM::Plugin::Configuration

Inherits:
Object
  • Object
show all
Includes:
Nucleon::Mixin::SubConfig
Defined in:
lib/core/plugin/configuration.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.register_idsObject




10
11
12
# File 'lib/core/plugin/configuration.rb', line 10

def self.register_ids
  [ :name ]
end

Instance Method Details

#initialized?(options = {}) ⇒ Boolean


Checks

Returns:

  • (Boolean)


30
31
32
# File 'lib/core/plugin/configuration.rb', line 30

def initialized?(options = {})
  true
end

#normalize(reload) ⇒ Object


Plugin interface



17
18
19
20
21
22
23
24
25
# File 'lib/core/plugin/configuration.rb', line 17

def normalize(reload)
  super

  logger.debug("Initializing source sub configuration")
  init_subconfig(true) unless reload

  yield if block_given?
  parse
end

#override(properties, keys = nil) ⇒ Object




67
68
69
70
71
72
73
74
75
76
77
# File 'lib/core/plugin/configuration.rb', line 67

def override(properties, keys = nil)
  if initialized?
    if keys.nil?
      import(properties)
    else
      set(keys, Nucleon::Config.new(get(keys), {}, true, false).import(properties).export)
    end
    yield if block_given?
  end
  myself
end

#parse(wipe = true) ⇒ Object




49
50
51
52
53
54
55
# File 'lib/core/plugin/configuration.rb', line 49

def parse(wipe = true)
  if initialized?
    clear if wipe
    yield if block_given?
  end
  export
end

#saveObject




59
60
61
62
63
# File 'lib/core/plugin/configuration.rb', line 59

def save
  if initialized?
    yield if block_given?
  end
end

#wipeObject


Operations



40
41
42
43
44
45
# File 'lib/core/plugin/configuration.rb', line 40

def wipe
  if initialized?
    clear
    yield if block_given?
  end
end