Skip to content

Instantly share code, notes, and snippets.

@lsegal
Created May 20, 2009 20:04
Show Gist options
  • Save lsegal/115055 to your computer and use it in GitHub Desktop.
Save lsegal/115055 to your computer and use it in GitHub Desktop.
class YARD::Handlers::RemoteHandler < YARD::Handlers::Base
handles /\Aremote/
def process
name_token = statement.tokens[2]
name = name_token.text.sub(/:/, '')
o1 = MethodObject.new(namespace, name, :instance)
o2 = MethodObject.new(namespace, "#{name}_cached", :instance)
register(o1, o2)
o1.visibiliy = :public
o1.parameters = [["params", "{}"]]
o1.docstring = [statement.comments,
"@see RemoteCall#remote",
"@return [String] Response"].join("\n")
o2.visibility = :public
o2.parameters = [["params", "{}"]]
o2.docstring = ["Cached version of #{name}",
"@see #{namespace}##{name}",
"@param params as in Alien#response",
"@return [String] response"].join("\n")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment