bitgirder-platform 0.1.19 → 0.1.20
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.
- data/lib/bitgirder/core.rb +17 -16
- data/lib/doc-gen18.rb +1 -1
- data/lib/doc-gen20.rb +1 -1
- metadata +2 -2
data/lib/bitgirder/core.rb
CHANGED
|
@@ -542,6 +542,17 @@ class BitGirderAttribute
|
|
|
542
542
|
def get_instance_value( inst )
|
|
543
543
|
inst.instance_variable_get( @id_sym )
|
|
544
544
|
end
|
|
545
|
+
|
|
546
|
+
public
|
|
547
|
+
def get_default_value
|
|
548
|
+
|
|
549
|
+
case d = @default
|
|
550
|
+
when Proc then d.call
|
|
551
|
+
when Class then d.new
|
|
552
|
+
when Array, Hash then d.clone
|
|
553
|
+
else d == nil && @is_list ? [] : d
|
|
554
|
+
end
|
|
555
|
+
end
|
|
545
556
|
end
|
|
546
557
|
|
|
547
558
|
class BitGirderClassDefinition
|
|
@@ -599,17 +610,6 @@ class BitGirderClassDefinition
|
|
|
599
610
|
hash[ ident ] || hash[ ident.to_s ]
|
|
600
611
|
end
|
|
601
612
|
|
|
602
|
-
private
|
|
603
|
-
def get_default_val( attr )
|
|
604
|
-
|
|
605
|
-
case d = attr.default
|
|
606
|
-
when Proc then d.call
|
|
607
|
-
when Class then d.new
|
|
608
|
-
when Array, Hash then d.clone
|
|
609
|
-
else d == nil && attr.is_list ? [] : d
|
|
610
|
-
end
|
|
611
|
-
end
|
|
612
|
-
|
|
613
613
|
private
|
|
614
614
|
def apply_processor( attr, val )
|
|
615
615
|
|
|
@@ -635,7 +635,7 @@ class BitGirderClassDefinition
|
|
|
635
635
|
val = hash.key?( ident ) ? hash[ ident ] : hash[ ident.to_s ]
|
|
636
636
|
|
|
637
637
|
if val == nil
|
|
638
|
-
val =
|
|
638
|
+
val = attr.get_default_value # could still end up being nil
|
|
639
639
|
else
|
|
640
640
|
val = apply_processor( attr, val )
|
|
641
641
|
end
|
|
@@ -990,9 +990,9 @@ class BitGirderCliApplication < BitGirderClass
|
|
|
990
990
|
|
|
991
991
|
if desc = attr.description
|
|
992
992
|
|
|
993
|
-
# attr
|
|
993
|
+
# attr default could be the boolean false, which we still want to
|
|
994
994
|
# display
|
|
995
|
-
unless ( defl = attr.
|
|
995
|
+
unless ( defl = attr.get_default_value ) == nil
|
|
996
996
|
defl = defl.call if defl.is_a?( Proc )
|
|
997
997
|
desc += " (Default: #{default_to_s( defl )})"
|
|
998
998
|
end
|
|
@@ -1008,8 +1008,9 @@ class BitGirderCliApplication < BitGirderClass
|
|
|
1008
1008
|
|
|
1009
1009
|
attr = argh[ :attr ]
|
|
1010
1010
|
ident = attr.identifier
|
|
1011
|
-
|
|
1012
|
-
|
|
1011
|
+
|
|
1012
|
+
# could be nil either way
|
|
1013
|
+
prev = argh[ :argh ][ ident ] || attr.get_default_value
|
|
1013
1014
|
|
|
1014
1015
|
val = argh[ :arg ]
|
|
1015
1016
|
# val = attr.processor.call( val ) if attr.processor
|
data/lib/doc-gen18.rb
CHANGED
data/lib/doc-gen20.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bitgirder-platform
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.20
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
12
|
+
date: 2013-03-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: Contains core classes and interfaces for building event logger implementations.
|
|
15
15
|
Also includes helper classes for incorporating assertions about event logging into
|