lib/k_doc/settings.rb in k_doc-0.0.5 vs lib/k_doc/settings.rb in k_doc-0.0.6
- old
+ new
@@ -4,10 +4,12 @@
module KDoc
# Builds up key/value settings from the block
# and applies them to a key coded node on the hash
class Settings
+ include Logging
+
attr_reader :parent
attr_reader :key
alias kp parent
@@ -71,18 +73,18 @@
# Handles Getter method and method with single parameter
# object.my_name
# object.my_name('david')
def add_getter_or_param_method(name)
- # L.progress(1, 'add_getter_or_param_method')
+ # log.progress(1, 'add_getter_or_param_method')
self.class.class_eval do
- # L.progress(2, 'add_getter_or_param_method')
+ # log.progress(2, 'add_getter_or_param_method')
name = name.to_s.gsub(/=$/, '')
- # L.progress(3, 'add_getter_or_param_method')
+ # log.progress(3, 'add_getter_or_param_method')
define_method(name) do |*args|
- # L.progress(4, 'add_getter_or_param_method')
- # L.kv 'add_getter_or_param_method', name
+ # log.progress(4, 'add_getter_or_param_method')
+ # log.kv 'add_getter_or_param_method', name
raise KDoc::Error, 'Multiple setting values is not supported' if args.length > 1
if args.length.zero?
get_value(name)
else
@@ -93,18 +95,18 @@
end
# Handles Setter method
# object.my_name = 'david'
def add_setter_method(name)
- # L.progress(1, 'add_setter_method')
+ # log.progress(1, 'add_setter_method')
self.class.class_eval do
- # L.progress(2, 'add_setter_method')
+ # log.progress(2, 'add_setter_method')
name = name.to_s.gsub(/=$/, '')
- # L.progress(3, 'add_setter_method')
- # L.kv 'add_setter_method', name
+ # log.progress(3, 'add_setter_method')
+ # log.kv 'add_setter_method', name
define_method("#{name}=") do |value|
- # L.progress(4, 'add_setter_method')
- # L.kv 'value', value
+ # log.progress(4, 'add_setter_method')
+ # log.kv 'value', value
my_data[name.to_s] = value
end
end
end