Module: ZerigoDNS::Resource::Naming::ClassMethods
- Defined in:
- lib/zerigodns/resource/naming.rb
Instance Method Summary collapse
-
#base_path(path = nil) ⇒ String
Sets or gets the “base path”, where the resource is located.
-
#default_base_path ⇒ String
Default base path.
-
#default_resource_name ⇒ String
Default Resource Name.
-
#resource_name(name = nil) ⇒ String
Sets & gets the “resource name”, which is required for the create & update actions.
Instance Method Details
#base_path(path = nil) ⇒ String
Sets or gets the “base path”, where the resource is located.
35 36 37 38 39 40 |
# File 'lib/zerigodns/resource/naming.rb', line 35 def base_path path=nil if path @base_path = path end @base_path || default_base_path end |
#default_base_path ⇒ String
Default base path.
17 18 19 |
# File 'lib/zerigodns/resource/naming.rb', line 17 def default_base_path "#{resource_name}s" end |
#default_resource_name ⇒ String
Default Resource Name
9 10 11 12 |
# File 'lib/zerigodns/resource/naming.rb', line 9 def default_resource_name result = self.to_s.split("::").last.gsub(/([A-Z])/, '_\1').downcase result.slice 1, result.length end |
#resource_name(name = nil) ⇒ String
Sets & gets the “resource name”, which is required for the create & update actions.
25 26 27 28 29 30 |
# File 'lib/zerigodns/resource/naming.rb', line 25 def resource_name name=nil if name @resource_name = name end @resource_name || default_resource_name end |