I am working on an application to automate testing for SQL injection vulnerability. It is currently named Deft and is for a University project.
I want to be able to run tests from a command line, or an interactive console. I am coding several classes. (Deft::Cli, Deft::Console etc.)
Here’s what I think I’d like to do.
module Deft
module App
attr_accessor :origin
@origin = { "host" => "localhost", "port" => "80" }
end
end
module Deft
class Console
include App
def initialize
puts origin
end
end
end
The example has been simplified, but the point is that the default values (and structure) get defined in the Deft::App module.
The problem as I can tell is that although methods.grep(/origin/) from inside a console instance does indeed give me ["origin=", "origin"] calling origin returns nil. Instead of the values I define in Deft::App. It makes sense that it doesn’t work, but I don’t know how to make it work.
What about this?