Hi,
I'm having trouble to factor some simple code. Since, I have been stuck for
several days now I ask the question here.
# Beginning of code
module DefWithName
def integer(name, options = {})
store_result name, MyInteger.new(options)
end
def id(name)
integer(name, an_options: true)
end
end
module DefWithoutName
def integer(options = {})
store_result MyInteger.new(options)
end
def id
integer(an_options: true)
end
end
class A; include DefWithName; end
class AA; include DefWithName; end
class B; include DefWithoutName; end
class BB; include DefWithoutName; end
# End of code
Constraints:
- The "id" function has to call "integer" and not "store_result" because it
may be defined as a plugin.
- The functions must still raise ArgumentError as they already do.
Any ideas?
Regards,
-Nico
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.