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




14
15
16
# File 'lib/core/plugin/configuration.rb', line 14

def self.register_ids
  [ :name ]
end

Instance Method Details

#initialized?(options = {}) ⇒ Boolean


Checks

Returns:

  • (Boolean)


34
35
36
# File 'lib/core/plugin/configuration.rb', line 34

def initialized?(options = {})
  true
end

#normalize(reload) ⇒ Object


Plugin interface



21
22
23
24
25
26
27
28
29
# File 'lib/core/plugin/configuration.rb', line 21

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




71
72
73
74
75
76
77
78
79
80
81
# File 'lib/core/plugin/configuration.rb', line 71

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




53
54
55
56
57
58
59
# File 'lib/core/plugin/configuration.rb', line 53

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

#saveObject




63
64
65
66
67
# File 'lib/core/plugin/configuration.rb', line 63

def save
  if initialized?
    yield if block_given?
  end
end

#wipeObject


Operations



44
45
46
47
48
49
# File 'lib/core/plugin/configuration.rb', line 44

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