Code cleanup, improved String.to_filename.
This commit is contained in:
parent
644ecc6ef8
commit
9a702b528c
2 changed files with 7 additions and 4 deletions
|
@ -9,7 +9,7 @@ module ApplicationLib
|
|||
|
||||
load adapter based on setting option
|
||||
|
||||
result = self.load_adapter_by_setting( 'some_setting_with_class_name' )
|
||||
result = self.load_adapter_by_setting('some_setting_with_class_name')
|
||||
|
||||
returns
|
||||
|
||||
|
@ -18,7 +18,7 @@ returns
|
|||
=end
|
||||
|
||||
def load_adapter_by_setting(setting)
|
||||
adapter = Setting.get( setting )
|
||||
adapter = Setting.get(setting)
|
||||
return if !adapter
|
||||
|
||||
# load backend
|
||||
|
@ -29,7 +29,7 @@ returns
|
|||
|
||||
load adapter
|
||||
|
||||
result = self.load_adapter( 'Some::Classname' )
|
||||
result = self.load_adapter('Some::Classname')
|
||||
|
||||
returns
|
||||
|
||||
|
|
|
@ -32,7 +32,10 @@ class String
|
|||
|
||||
def to_filename
|
||||
camel_cased_word = "#{self}"
|
||||
camel_cased_word.gsub(/::/, '/').downcase
|
||||
camel_cased_word.gsub(/::/, '/')
|
||||
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
||||
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
||||
.tr('-', '_').downcase
|
||||
end
|
||||
|
||||
=begin
|
||||
|
|
Loading…
Reference in a new issue