Module: CMDB
- Defined in:
- lib/cmdb.rb,
lib/cmdb/shell.rb,
lib/cmdb/source.rb,
lib/cmdb/version.rb,
lib/cmdb/commands.rb,
lib/cmdb/rewriter.rb,
lib/cmdb/interface.rb,
lib/cmdb/source/file.rb,
lib/cmdb/source/consul.rb,
lib/cmdb/source/memory.rb,
lib/cmdb/source/network.rb
Defined Under Namespace
Modules: Commands, Shell Classes: BadCommand, BadData, BadKey, BadValue, EnvironmentConflict, Error, FileRewriter, Interface, MissingKey, NameConflict, Rewriter, Source, ValueConflict
Constant Summary collapse
- SEPARATOR =
Character that separates keys from subkeys in the standard notation for CMDB keys.
'.'.freeze
- VALID_KEY =
Regexp that matches valid key names. Key names consist of one or more dot-separated words; each word must begin with a lowercase alpha character and may contain alphanumerics or underscores.
/^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)*$/i.freeze
- Conflict =
Deprecated name for ValueConflict
ValueConflict- VERSION =
'3.0.1'.freeze
Class Method Summary collapse
-
.join(*pieces) ⇒ String
Transform a list of key components into a dot-notation key.
- .log ⇒ Object
- .log=(log) ⇒ Object
-
.split(key, parts = 0) ⇒ Array
Split a dot-notation CMDB key into its constituent parts and return an Array.
Class Method Details
.join(*pieces) ⇒ String
Transform a list of key components into a dot-notation key.
143 144 145 146 |
# File 'lib/cmdb.rb', line 143 def join(*pieces) pieces.flatten! pieces.join(SEPARATOR) end |
.log ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/cmdb.rb', line 148 def log unless @log @log = Logger.new($stderr) @log.formatter = Proc.new do |severity, datetime, progname, msg| "#{severity}: #{msg}\n" end @log.level = Logger::WARN end @log end |
.log=(log) ⇒ Object
162 163 164 |
# File 'lib/cmdb.rb', line 162 def log=(log) @log = log end |
.split(key, parts = 0) ⇒ Array
Split a dot-notation CMDB key into its constituent parts and return an Array. Optionally limit the amount of splitting done by passing parts > 0.
136 137 138 |
# File 'lib/cmdb.rb', line 136 def split(key, parts=0) key.split(SEPARATOR, parts) end |