Skip to content

Instantly share code, notes, and snippets.

@julik
Created March 27, 2013 17:11
Show Gist options
  • Save julik/5256137 to your computer and use it in GitHub Desktop.
Save julik/5256137 to your computer and use it in GitHub Desktop.
class OxMama
def path
end
end
class WyrwiGlaz < OxMama
def parent_path
'junk'
end
def node_id
'koshmar'
end
# Returns the result of the super call, or if it is nil
# the parent path, and also if the node_id is not nil as
# well as the parent path will return the parent path suffixed
# with the predicate in square brackets (maybe), because I already
# had too much acid anyway. who cares we do have tests.
# TODO: next coder after me please rewrite this junk.
def path
super||(p=parent_path)+(node_id&&p!=''?"[#{node_id}]":'')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment