Sha256: e429819cfb09ee18d8150763275b52a14c620d66bcf94f32ff53cf920c908fb0
Contents?: true
Size: 894 Bytes
Versions: 4
Compression:
Stored size: 894 Bytes
Contents
$: << "../lib" require 'configdsl' ConfigDSL.execute do lazy_varaible lazy!{ Time.now } standart_variable Time.now lower_level_also_works do lazy_time lazy!{ Time.now } end delta lazy!(Time.now){ |config_reading_time| Time.now.to_i - config_reading_time.to_i } end # We sleep for time to change sleep 2 print "Standart: " p ConfigDSL.standart_variable print "Lazy: " p ConfigDSL.lazy_varaible print "Lazy (another way to get): " p ConfigDSL[:lazy_varaible] print "Lazy (force LazyValue object instead of its content): " p ConfigDSL.original_reader(:lazy_varaible) print "Non-toplevel lazy variables (only evaluated on request): " p ConfigDSL.lower_level_also_works print "And this value processed: " p ConfigDSL.lower_level_also_works.lazy_time print "Delta between lazy and standart Time.now (should -> 2): " p ConfigDSL.delta
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
configdsl-1.2.2 | examples/example_lazy.rb |
configdsl-1.2.1 | examples/example_lazy.rb |
configdsl-1.2.0 | examples/example_lazy.rb |
configdsl-1.1.0 | examples/example_lazy.rb |