lib/como.rb in como-0.1.5 vs lib/como.rb in como-0.1.6
- old
+ new
@@ -1848,9 +1848,24 @@
suball.detect { |i| i.opt == str }
end
end
+ # Convert to hash representation.
+ #
+ # Keys are symbols: name, type, given, value, subopt, subcmd.
+ def to_hash
+ h = {}
+ h[ :name ] = @name
+ h[ :type ] = @type
+ h[ :given ] = @given
+ h[ :value ] = @value
+ h[ :subopt ] = @subopt.map{|i| i.to_hash }
+ h[ :subcmd ] = @subcmd.map{|i| i.to_hash }
+ h
+ end
+
+
# Como error printout.
#
# @param str [String] Error message.
# @param nl [Boolean] Prepend msg with newline.
def error( str, nl = false )