Skip to content

Instantly share code, notes, and snippets.

@walf443
Created August 21, 2008 22:25
Show Gist options
  • Save walf443/6661 to your computer and use it in GitHub Desktop.
Save walf443/6661 to your computer and use it in GitHub Desktop.
require 'classx'
#=> true
require 'classx/util'
#=> true
class Hoge < ClassX
extend Util
has_writer_with_default :x, 30
end
#=> nil
Hoge.new
#=> #<Hoge:0x24428 @__attribute_of={"x"=><#ClassX::Attribute {:optional=>true, :writable=>true, :default=>30}:73230 >}>
hoge = Hoge.new
#=> #<Hoge:0x1b184 @__attribute_of={"x"=><#ClassX::Attribute {:optional=>true, :writable=>true, :default=>30}:54850 >}>
hoge.x
#=> 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment