Skip to content

Instantly share code, notes, and snippets.

@vvs
Created March 12, 2010 15:24
Show Gist options
  • Save vvs/330418 to your computer and use it in GitHub Desktop.
Save vvs/330418 to your computer and use it in GitHub Desktop.
# All elements (including nested elements) are registered so we can access them easily.
def acquire_element(name, clazz)
element = @elements[name + clazz.to_s]
return element if element
# ****** HERE ***** This block of code is EVIL!!!! <---------------------
# Not registered in ant's type registry for this project (nested el?)
unless @helper.get_definition(name)
@project.log "Adding #{name} -> #{clazz.inspect}", 5
@helper.add_data_type_definition(name, clazz)
end
@elements[name + clazz.to_s] = :give_it_something_to_prevent_endless_recursive_defs
@elements[name + clazz.to_s] = Element.new(self, name, clazz)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment