module Mindmap::Node
a module that must be included to any graph node it has methods needed by the framework to render the node
Public Class Methods
new(params = {})
click to toggle source
# File lib/mindmap/node.rb, line 11 def initialize(params = {}) assign_params(params) end
Public Instance Methods
assign_params(params)
click to toggle source
assign a hash values to attributes with the same name
# File lib/mindmap/node.rb, line 16 def assign_params(params) params.each do |key, value| if self.class.public_method_defined?("#{key}=") public_send("#{key}=", value) end end end
render(format = :html)
click to toggle source
renders the node ERB view file and returns the result
# File lib/mindmap/node.rb, line 25 def render(format = :html) Renderer.render("#{view}.#{format}", binding) end
url()
click to toggle source
returns the node url that could be used for a link
# File lib/mindmap/node.rb, line 37 def url '/' + self.class.name.underscore.gsub('_node', '') end
view()
click to toggle source
The path to the view file relative to the “nodes” directory by default the file is the class name underscored e.g if node class is `Graph::NodeName` it returns `graph/node_name`
# File lib/mindmap/node.rb, line 32 def view self.class.name.underscore end