params 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/params.rb +9 -3
  2. data/lib/params/version.rb +1 -1
  3. metadata +2 -2
data/lib/params.rb CHANGED
@@ -122,6 +122,7 @@ module Params
122
122
  end
123
123
  end
124
124
  when 'Complex' then
125
+ when 'Global' then
125
126
  unless @value.nil?
126
127
  unless (value.class.eql? Hash) or (value.class.eql? Array)
127
128
  raise("Parameter:'#{@name}' type:'Complex' but value type to override " \
@@ -232,7 +233,8 @@ module Params
232
233
  # full user directory).
233
234
  def Params.path(name, value, description)
234
235
  raise_error_if_param_exists(name)
235
- @globals_db[name] = Param.new(name, File.expand_path(value), 'Path', description)
236
+ value = File.expand_path(value) unless value.nil?
237
+ @globals_db[name] = Param.new(name, value, 'Path', description)
236
238
  end
237
239
 
238
240
  def Params.complex(name, value, description)
@@ -240,6 +242,11 @@ module Params
240
242
  @globals_db[name] = Param.new(name, value, 'Complex', description)
241
243
  end
242
244
 
245
+ def Params.global(name, value, description)
246
+ raise_error_if_param_exists(name)
247
+ @globals_db[name] = Param.new(name, value, 'Global', description)
248
+ end
249
+
243
250
  # Define new global parameter of type Boolean.
244
251
  def Params.boolean(name, value, description)
245
252
  raise_error_if_param_exists(name)
@@ -287,13 +294,12 @@ module Params
287
294
  end
288
295
 
289
296
  # Add parameters to log init messages (used by Log.init if param:print_params_to_stdout is true)
290
- @init_debug_messages << "\n"
291
297
  @init_debug_messages << 'Initialized executable parameters:'
292
298
  @init_debug_messages << '---------------------------------'
293
299
  counter=0
294
300
  @globals_db.values.each do |param|
295
301
  counter += 1
296
- @init_debug_messages << "#{counter}: #{param.name}=#{param.value}"
302
+ @init_debug_messages << "Param ##{counter}: #{param.name}=#{param.value}"
297
303
  end
298
304
  @init_debug_messages << '---------------------------------'
299
305
  end
@@ -1,3 +1,3 @@
1
1
  module Params
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: params
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-25 00:00:00.000000000 Z
13
+ date: 2013-06-12 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Dynamically stores, parses and providers params. Uses module local readers.
16
16
  email: bbfsdev@gmail.com