Module: KRPC::Doc::SuffixMethods
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
#method_missing(method, *args, &block) ⇒ Object
174
175
176
177
178
179
180
181
182
|
# File 'lib/krpc/doc.rb', line 174
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
|
Class Method Details
.included(base) ⇒ Object
165
166
167
168
169
170
171
172
|
# File 'lib/krpc/doc.rb', line 165
def self.included(base)
base.extend self
class << base
def krpc_name
class_name
end
end
end
|
Instance Method Details
#respond_to_missing?(method) ⇒ Boolean
184
185
186
187
188
189
|
# File 'lib/krpc/doc.rb', line 184
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
|