Skip to content

Configuration that takes a previous configuration breaks nesting #3

@duckworth

Description

@duckworth
require 'configuration'

b = Configuration.for('b'){
        host "codeforpeople.com"

        www {
            port 80
            url "http://#{ host }:#{ port }"
        }

        db {
            port 5342 
            url "db://#{ host }:#{ port }"
        }

        mail {
            host "gmail.com"
            port 25 
            url "mail://#{ host }:#{ port }"
        }
    }

c = Configuration.for('c' ,b){
        foo 'bar'
    }

puts b.mail.url 
puts c.mail.url

outputs

mail://gmail.com:25
test.rb:28:in `<main>': undefined method `url' for {:host=>"gmail.com", :port=>25, :url=>"mail://gmail.com:25"}:Hash       (NoMethodError)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions