lib/cfndsl/names.rb in cfndsl-0.0.13 vs lib/cfndsl/names.rb in cfndsl-0.0.14
- old
+ new
@@ -1,12 +1,18 @@
module CfnDsl
##
# iterates through the the valid case-insensitive names
# for "name".
- def self.methodNames(name)
- name_str = name.to_s
- yield name_str.to_sym
- n = name_str.dup
- n[0] = n[0].swapcase
- yield n.to_sym
+ def self.methodNames(name, &block)
+ if block then
+ name_str = name.to_s
+ yield name_str.to_sym
+ n = name_str.dup
+ n[0] = n[0].swapcase
+ yield n.to_sym
+ else
+ result = [name.dup,name.dup]
+ result[1][0] = result[1][0].swapcase
+ return result
+ end
end
end