configatron shorthand for namespaces
https://stackoverflow.com/questions/8130402
Solution
One easy thing you can do is this.
configatron.email.pop.tap do|pop|
pop.address = 'localhost'
pop.port = 22
end
Or even this.
pop = configatron.email.pop
pop.address = 'localhost'
pop.port = 22
You could try adding singleton methods to the configatron object too.
class << configatron
def pop; email.pop; end
end
configatron.pop.address = 'localhost'
configatron.pop.port = 22
Or even this.
class << configatron
def pop_address; email.pop.address; end
def pop_address=(addr); email.pop.address = addr; end
end
configatron.pop_address = 'address'
But this may end up breaking things (I'm assuming configatron works on method_missing). And it doesn't save much typing, but it can let you make some handy shortcuts to things hidden several namespaces deep.
Maybe you should just stick it out with the verbosity here though.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow