Module: KRPC::Doc::SuffixMethods
Defined Under Namespace
Modules: ClassMethods
Constant Summary
collapse
- DOCSTRING_SUFFIX =
"_doc"
- DOCSTRING_SUFFIX_REGEX =
/^(.+)(?:#{DOCSTRING_SUFFIX}(=)?)$/
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
permalink
#method_missing(method, *args, &block) ⇒ Object
[View source]
169
170
171
172
173
174
175
176
177
|
# File 'lib/krpc/doc.rb', line 169
def method_missing(method, *args, &block)
if DOCSTRING_SUFFIX_REGEX =~ method.to_s
documented_method_name = $1 + $2.to_s
if respond_to? documented_method_name.to_sym
return puts Doc.docstring_for_method(self,documented_method_name)
end
end
super
end
|
Instance Method Details
[View source]
179
180
181
182
183
184
|
# File 'lib/krpc/doc.rb', line 179
def respond_to_missing?(method, *)
if DOCSTRING_SUFFIX_REGEX =~ method.to_s
return true if respond_to? ($1 + $2.to_s).to_sym
end
super
end
|