loquacious 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/lib/loquacious.rb +1 -1
- data/lib/loquacious/configuration/help.rb +10 -7
- data/loquacious.gemspec +1 -1
- metadata +1 -1
data/History.txt
CHANGED
data/lib/loquacious.rb
CHANGED
@@ -73,11 +73,13 @@ class Loquacious::Configuration
|
|
73
73
|
# call-seq:
|
74
74
|
# show_attribute( name = nil, opts = {} )
|
75
75
|
#
|
76
|
-
#
|
76
|
+
# Use this method to show the description for a single attribute or for
|
77
|
+
# all the attributes if no _name_ is given. The options allow you to
|
78
|
+
# show the values along with the attributes and to hide the descriptions
|
79
|
+
# (if all you want to see are the values).
|
77
80
|
#
|
78
|
-
# show
|
79
|
-
# show
|
80
|
-
# show everything
|
81
|
+
# :descriptions => true to show descriptions and false to hide them
|
82
|
+
# :values => true to show values and false to hide them
|
81
83
|
#
|
82
84
|
def show_attribute( name = nil, opts = {} )
|
83
85
|
name, opts = nil, name if name.is_a?(Hash)
|
@@ -86,11 +88,12 @@ class Loquacious::Configuration
|
|
86
88
|
:values => false
|
87
89
|
}.merge!(opts)
|
88
90
|
|
89
|
-
|
91
|
+
rgxp = Regexp.new(normalize_attr(name))
|
90
92
|
show_description = opts[:descriptions]
|
91
93
|
show_value = opts[:values]
|
92
94
|
|
93
|
-
Iterator.new(@config).each
|
95
|
+
Iterator.new(@config).each do |node|
|
96
|
+
next unless rgxp =~ node.name
|
94
97
|
print_node(node, show_description, show_value)
|
95
98
|
end
|
96
99
|
end
|
@@ -108,7 +111,7 @@ class Loquacious::Configuration
|
|
108
111
|
#
|
109
112
|
def normalize_attr( name )
|
110
113
|
case name
|
111
|
-
when String, nil; name
|
114
|
+
when String, nil; name.to_s
|
112
115
|
when Symbol; name.to_s
|
113
116
|
when Array; name.join('.')
|
114
117
|
else
|
data/loquacious.gemspec
CHANGED