Created
June 4, 2014 20:23
-
-
Save fkaa/1da427d6a2370a66e42f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Kaffeh | |
| class Config | |
| attr_accessor :title, :width, :height | |
| def initialize(title = "Kaffeh", width = 600, height = 480) | |
| @title = title | |
| @width = width | |
| @height = height | |
| end | |
| def to_s | |
| return "[title: #{@title}, width: #{@width}, height: #{@height}]" | |
| end | |
| end | |
| def self.config(&blk) | |
| blk.call(Kaffeh::CONFIG) | |
| end | |
| CONFIG = Config.new | |
| end | |
| Kaffeh.config do |cfg| | |
| cfg.title = "Foo!!" | |
| end | |
| puts Kaffeh::CONFIG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment