loquacious 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ == 1.2.0 / 2009-04-05
2
+
3
+ * 1 minor enhancement
4
+ - Help#show now matches using a regular expression
5
+
1
6
  == 1.1.1 / 2009-04-05
2
7
 
3
8
  * 1 bug fix
@@ -2,7 +2,7 @@
2
2
  module Loquacious
3
3
 
4
4
  # :stopdoc:
5
- VERSION = '1.1.1'
5
+ VERSION = '1.2.0'
6
6
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
7
7
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
8
8
  # :startdoc:
@@ -73,11 +73,13 @@ class Loquacious::Configuration
73
73
  # call-seq:
74
74
  # show_attribute( name = nil, opts = {} )
75
75
  #
76
- # TODO: finish comments and docos
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 available attributes (with/without descriptions)
79
- # show current config
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
- name = normalize_attr(name)
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(name) do |node|
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{loquacious}
5
- s.version = "1.1.1"
5
+ s.version = "1.2.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Tim Pease"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loquacious
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pease