volt 0.6.5 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/Readme.md +47 -40
  3. data/VERSION +1 -1
  4. data/app/volt/controllers/notices_controller.rb +3 -3
  5. data/app/volt/tasks/live_query/data_store.rb +2 -2
  6. data/app/volt/tasks/live_query/live_query.rb +20 -20
  7. data/app/volt/tasks/live_query/live_query_pool.rb +6 -6
  8. data/app/volt/tasks/live_query/query_tracker.rb +15 -15
  9. data/app/volt/tasks/query_tasks.rb +13 -13
  10. data/app/volt/tasks/store_tasks.rb +7 -7
  11. data/app/volt/views/notices/index.html +17 -18
  12. data/lib/volt/assets/test.rb +2 -2
  13. data/lib/volt/benchmark/benchmark.rb +25 -23
  14. data/lib/volt/cli/asset_compile.rb +11 -0
  15. data/lib/volt/cli/new_gem.rb +16 -16
  16. data/lib/volt/cli.rb +14 -12
  17. data/lib/volt/console.rb +5 -6
  18. data/lib/volt/controllers/model_controller.rb +18 -18
  19. data/lib/volt/extra_core/array.rb +4 -4
  20. data/lib/volt/extra_core/hash.rb +3 -3
  21. data/lib/volt/extra_core/object.rb +6 -6
  22. data/lib/volt/extra_core/string.rb +6 -6
  23. data/lib/volt/extra_core/symbol.rb +5 -5
  24. data/lib/volt/extra_core/time.rb +4 -4
  25. data/lib/volt/extra_core/true_false.rb +6 -6
  26. data/lib/volt/extra_core/try.rb +9 -9
  27. data/lib/volt/models/array_model.rb +26 -26
  28. data/lib/volt/models/model.rb +35 -35
  29. data/lib/volt/models/model_hash_behaviour.rb +15 -15
  30. data/lib/volt/models/model_helpers.rb +8 -8
  31. data/lib/volt/models/model_wrapper.rb +6 -6
  32. data/lib/volt/models/persistors/array_store.rb +36 -36
  33. data/lib/volt/models/persistors/base.rb +6 -6
  34. data/lib/volt/models/persistors/flash.rb +5 -5
  35. data/lib/volt/models/persistors/model_identity_map.rb +2 -2
  36. data/lib/volt/models/persistors/model_store.rb +22 -22
  37. data/lib/volt/models/persistors/params.rb +3 -3
  38. data/lib/volt/models/persistors/query/query_listener.rb +14 -14
  39. data/lib/volt/models/persistors/query/query_listener_pool.rb +2 -2
  40. data/lib/volt/models/persistors/store.rb +8 -8
  41. data/lib/volt/models/persistors/store_factory.rb +2 -2
  42. data/lib/volt/models/url.rb +37 -37
  43. data/lib/volt/page/bindings/attribute_binding.rb +14 -14
  44. data/lib/volt/page/bindings/base_binding.rb +9 -9
  45. data/lib/volt/page/bindings/component_binding.rb +7 -7
  46. data/lib/volt/page/bindings/content_binding.rb +3 -3
  47. data/lib/volt/page/bindings/each_binding.rb +13 -13
  48. data/lib/volt/page/bindings/event_binding.rb +4 -4
  49. data/lib/volt/page/bindings/if_binding.rb +12 -12
  50. data/lib/volt/page/bindings/template_binding.rb +30 -30
  51. data/lib/volt/page/channel.rb +19 -19
  52. data/lib/volt/page/channel_stub.rb +6 -6
  53. data/lib/volt/page/document.rb +2 -2
  54. data/lib/volt/page/document_events.rb +4 -4
  55. data/lib/volt/page/draw_cycle.rb +3 -3
  56. data/lib/volt/page/memory_test.rb +6 -6
  57. data/lib/volt/page/page.rb +19 -19
  58. data/lib/volt/page/reactive_template.rb +9 -9
  59. data/lib/volt/page/sub_context.rb +5 -5
  60. data/lib/volt/page/targets/attribute_section.rb +9 -9
  61. data/lib/volt/page/targets/attribute_target.rb +3 -3
  62. data/lib/volt/page/targets/base_section.rb +2 -2
  63. data/lib/volt/page/targets/binding_document/component_node.rb +23 -23
  64. data/lib/volt/page/targets/binding_document/html_node.rb +2 -2
  65. data/lib/volt/page/targets/dom_section.rb +40 -38
  66. data/lib/volt/page/targets/dom_target.rb +2 -2
  67. data/lib/volt/page/tasks.rb +12 -12
  68. data/lib/volt/page/template_renderer.rb +4 -4
  69. data/lib/volt/page/url_tracker.rb +6 -6
  70. data/lib/volt/reactive/array_extensions.rb +2 -2
  71. data/lib/volt/reactive/destructive_methods.rb +5 -5
  72. data/lib/volt/reactive/event_chain.rb +25 -25
  73. data/lib/volt/reactive/events.rb +33 -33
  74. data/lib/volt/reactive/object_tracker.rb +21 -21
  75. data/lib/volt/reactive/object_tracking.rb +2 -2
  76. data/lib/volt/reactive/reactive_array.rb +57 -57
  77. data/lib/volt/reactive/reactive_tags.rb +16 -16
  78. data/lib/volt/reactive/reactive_value.rb +72 -72
  79. data/lib/volt/reactive/string_extensions.rb +3 -3
  80. data/lib/volt/router/routes.rb +22 -23
  81. data/lib/volt/server/component_handler.rb +5 -5
  82. data/lib/volt/server/component_templates.rb +14 -11
  83. data/lib/volt/server/html_parser/attribute_scope.rb +116 -0
  84. data/lib/volt/server/html_parser/each_scope.rb +18 -0
  85. data/lib/volt/server/html_parser/if_view_scope.rb +71 -0
  86. data/lib/volt/server/html_parser/sandlebars_parser.rb +219 -0
  87. data/lib/volt/server/html_parser/textarea_scope.rb +31 -0
  88. data/lib/volt/server/html_parser/view_handler.rb +82 -0
  89. data/lib/volt/server/html_parser/view_parser.rb +23 -0
  90. data/lib/volt/server/html_parser/view_scope.rb +145 -0
  91. data/lib/volt/server/rack/asset_files.rb +17 -17
  92. data/lib/volt/server/rack/component_paths.rb +18 -18
  93. data/lib/volt/server/rack/index_files.rb +8 -8
  94. data/lib/volt/server/rack/opal_files.rb +11 -11
  95. data/lib/volt/server/socket_connection_handler.rb +13 -13
  96. data/lib/volt/server/socket_connection_handler_stub.rb +2 -2
  97. data/lib/volt/server.rb +18 -18
  98. data/lib/volt/tasks/dispatcher.rb +5 -5
  99. data/lib/volt/utils/ejson.rb +2 -2
  100. data/lib/volt/utils/generic_counting_pool.rb +8 -8
  101. data/lib/volt/utils/generic_pool.rb +16 -16
  102. data/lib/volt/volt/environment.rb +4 -4
  103. data/lib/volt.rb +6 -6
  104. data/spec/integration/test_integration_spec.rb +2 -2
  105. data/spec/models/event_chain_spec.rb +38 -38
  106. data/spec/models/model_spec.rb +128 -128
  107. data/spec/models/old_model_spec.rb +17 -17
  108. data/spec/models/persistors/params_spec.rb +3 -3
  109. data/spec/models/persistors/store_spec.rb +7 -7
  110. data/spec/models/reactive_array_spec.rb +82 -82
  111. data/spec/models/reactive_generator_spec.rb +11 -11
  112. data/spec/models/reactive_tags_spec.rb +6 -6
  113. data/spec/models/reactive_value_spec.rb +70 -70
  114. data/spec/models/store_spec.rb +4 -4
  115. data/spec/models/string_extensions_spec.rb +13 -13
  116. data/spec/page/bindings/content_binding_spec.rb +6 -6
  117. data/spec/page/sub_context_spec.rb +1 -1
  118. data/spec/router/routes_spec.rb +3 -3
  119. data/spec/server/html_parser/sample_page.html +595 -0
  120. data/spec/server/html_parser/sandlebars_parser_spec.rb +192 -0
  121. data/spec/server/html_parser/view_parser_spec.rb +286 -0
  122. data/spec/server/rack/asset_files_spec.rb +6 -6
  123. data/spec/server/rack/component_paths_spec.rb +5 -5
  124. data/spec/spec_helper.rb +4 -5
  125. data/spec/store/mongo_spec.rb +3 -3
  126. data/spec/tasks/live_query_spec.rb +6 -6
  127. data/spec/tasks/query_tasks.rb +4 -4
  128. data/spec/tasks/query_tracker_spec.rb +20 -20
  129. data/spec/templates/targets/binding_document/component_node_spec.rb +4 -4
  130. data/spec/templates/template_binding_spec.rb +28 -28
  131. data/spec/utils/generic_counting_pool_spec.rb +5 -5
  132. data/spec/utils/generic_pool_spec.rb +14 -14
  133. data/templates/newgem/app/newgem/views/index/index.html +1 -2
  134. data/templates/project/app/home/config/dependencies.rb +1 -1
  135. data/templates/project/app/home/controllers/index_controller.rb +1 -1
  136. data/templates/project/app/home/views/index/about.html +4 -6
  137. data/templates/project/app/home/views/index/home.html +4 -5
  138. data/templates/project/app/home/views/index/index.html +8 -9
  139. data/templates/project/spec/spec_helper.rb +1 -1
  140. metadata +17 -8
  141. data/lib/volt/server/binding_setup.rb +0 -2
  142. data/lib/volt/server/if_binding_setup.rb +0 -31
  143. data/lib/volt/server/scope.rb +0 -43
  144. data/lib/volt/server/template_parser.rb +0 -453
  145. data/spec/server/template_parser_spec.rb +0 -50
@@ -4,18 +4,18 @@ class StoreTasks
4
4
  def initialize(channel=nil, dispatcher=nil)
5
5
  @@mongo_db ||= Mongo::MongoClient.new("localhost", 27017)
6
6
  @@db ||= @@mongo_db.db("development")
7
-
7
+
8
8
  @channel = channel
9
9
  @dispatcher = dispatcher
10
10
  end
11
-
11
+
12
12
  def db
13
13
  @@db
14
14
  end
15
-
15
+
16
16
  def save(collection, data)
17
17
  # puts "Insert: #{data.inspect} on #{collection.inspect}"
18
-
18
+
19
19
  data = data.symbolize_keys
20
20
  id = data[:_id]
21
21
 
@@ -34,14 +34,14 @@ class StoreTasks
34
34
  raise
35
35
  end
36
36
  end
37
-
37
+
38
38
  QueryTasks.live_query_pool.updated_collection(collection, @channel)
39
39
  end
40
40
 
41
41
  def delete(collection, id)
42
42
  puts "DELETE: #{collection.inspect} - #{id.inspect}"
43
43
  @@db[collection].remove('_id' => id)
44
-
44
+
45
45
  QueryTasks.live_query_pool.updated_collection(collection, @channel)
46
46
  end
47
- end
47
+ end
@@ -1,18 +1,17 @@
1
- <:body>
2
- {#if page._reloading}
3
- <div class="notices alert alert-info">Reloading...</div>
4
- {/}
5
- {#if channel.status == :reconnecting}
6
- <div class="notices alert alert-info">
7
- Connection Lost... {channel.error}...
8
- {#if channel.reconnect_interval} Reconnecting in {(channel.reconnect_interval / 1000.0).round} sec{/}
9
- </div>
10
- {/}
11
- {#if !flash.empty?}
12
- <div class="notices alert alert-info" e-click="flash.clear">
13
- {#each flash._notices as notice}
14
- <p>{notice}</p>
15
- {/}
16
- </div>
17
- {/}
18
- </:body>
1
+ <:Body>
2
+ {#if page._reloading}
3
+ <div class="notices alert alert-info">Reloading...</div>
4
+ {/}
5
+ {#if channel.status == :reconnecting}
6
+ <div class="notices alert alert-info">
7
+ Connection Lost... {channel.error}...
8
+ {#if channel.reconnect_interval} Reconnecting in {(channel.reconnect_interval / 1000.0).round} sec{/}
9
+ </div>
10
+ {/}
11
+ {#if !flash.empty?}
12
+ <div class="notices alert alert-info" e-click="flash.clear">
13
+ {#each flash._notices as notice}
14
+ <p>{notice}</p>
15
+ {/}
16
+ </div>
17
+ {/}
@@ -1,6 +1,6 @@
1
1
  require 'sass'
2
2
 
3
- sass_engine = Sass::Engine.new(template, {syntax: :scss, filename: 'cool.css.scss', sourcemap: true}) ; output =
3
+ sass_engine = Sass::Engine.new(template, {syntax: :scss, filename: 'cool.css.scss', sourcemap: true}) ; output =
4
4
  sass_engine.render_with_sourcemap('/source_maps/')
5
5
 
6
- puts a[1].to_json(:css_path => '/cool.css', :sourcemap_path => '/source_maps/cool.css.map')
6
+ puts a[1].to_json(:css_path => '/cool.css', :sourcemap_path => '/source_maps/cool.css.map')
@@ -1,25 +1,27 @@
1
- class Benchmark
2
- def self.bm(iterations=1)
3
- puts "BM"
4
-
5
- times = []
6
- total_time = nil
7
- result = nil
8
-
9
- iterations.times do
10
- start_time = `Date.now()`
11
- result = yield
12
- end_time = `Date.now()`
13
- total_time = `end_time - start_time`
14
- times << total_time
1
+ if RUBY_PLATFORM == 'opal'
2
+ class Benchmark
3
+ def self.bm(iterations=1)
4
+ puts "BM"
5
+
6
+ times = []
7
+ total_time = nil
8
+ result = nil
9
+
10
+ iterations.times do
11
+ start_time = `Date.now()`
12
+ result = yield
13
+ end_time = `Date.now()`
14
+ total_time = `end_time - start_time`
15
+ times << total_time
16
+ end
17
+
18
+ if iterations == 1
19
+ puts "TOTAL TIME: #{total_time}ms"
20
+ else
21
+ puts "Times: #{times.inspect}"
22
+ end
23
+
24
+ return result
15
25
  end
16
-
17
- if iterations == 1
18
- puts "TOTAL TIME: #{total_time}ms"
19
- else
20
- puts "Times: #{times.inspect}"
21
- end
22
-
23
- return result
24
26
  end
25
- end
27
+ end
@@ -0,0 +1,11 @@
1
+ class CLI
2
+
3
+ desc "precompile", "precompile all application assets"
4
+ def precompile
5
+ require 'volt'
6
+ require 'volt/server/rack/component_paths'
7
+
8
+ puts ComponentPaths.new(Volt.root).components.inspect
9
+ end
10
+
11
+ end
@@ -4,7 +4,7 @@ require 'fileutils'
4
4
 
5
5
  # Creates a new "volt" gem, which can be used to easily repackage
6
6
  # components.
7
- class NewGem
7
+ class NewGem
8
8
  def initialize(thor, name, options)
9
9
  @thor = thor
10
10
  @component_name = name.chomp("/")
@@ -16,16 +16,16 @@ class NewGem
16
16
  @thor.say("There is already a gem named #{@name}. Please choose a different name.", :red)
17
17
  return
18
18
  end
19
-
19
+
20
20
  @options = options
21
21
  @namespaced_path = @name.tr('-', '/')
22
22
  @opts = gem_options
23
23
  @target = File.join(Dir.pwd, @name)
24
-
24
+
25
25
  copy_files
26
26
  copy_options
27
27
  end
28
-
28
+
29
29
  # Check with the rubygems api to see if this gem name is available.
30
30
  def gem_is_available?
31
31
  @thor.say("Check if #{@name} is available as a gem name.", :yellow)
@@ -33,7 +33,7 @@ class NewGem
33
33
 
34
34
  http = Net::HTTP.new(uri.host, uri.port)
35
35
  http.use_ssl = true
36
-
36
+
37
37
  request = Net::HTTP::Get.new(uri.request_uri)
38
38
  response = http.request(request)
39
39
 
@@ -42,7 +42,7 @@ class NewGem
42
42
  # rubygems is down, skip check
43
43
  return true
44
44
  end
45
-
45
+
46
46
  def copy_files
47
47
  @thor.directory("newgem/app/newgem", File.join("#{@target}", "app/#{@component_name}"), @opts)
48
48
  copy("newgem/Gemfile.tt", "Gemfile")
@@ -54,7 +54,7 @@ class NewGem
54
54
  copy("newgem/VERSION", "VERSION")
55
55
  FileUtils.mkdir_p(File.join(@target, "lib/#{@namespaced_path}"))
56
56
  end
57
-
57
+
58
58
  def copy_options
59
59
  if @options[:bin]
60
60
  copy("newgem/bin/newgem.tt", "bin/#{@name}")
@@ -75,18 +75,18 @@ class NewGem
75
75
  run("#{@options["edit"]} \"#{gemspec_dest}\"") # Open gemspec in editor
76
76
  end
77
77
  end
78
-
78
+
79
79
  private
80
80
  def copy(from, to)
81
81
  @thor.template(File.join(from), File.join(@target, to), @opts)
82
82
  end
83
-
83
+
84
84
  def gem_options
85
85
  constant_name = get_constant_name
86
86
  constant_array = constant_name.split('::')
87
87
  git_user_name = `git config user.name`.chomp
88
88
  git_user_email = `git config user.email`.chomp
89
-
89
+
90
90
  opts = {
91
91
  :name => @name,
92
92
  :namespaced_path => @namespaced_path,
@@ -97,20 +97,20 @@ class NewGem
97
97
  :test => @options[:test],
98
98
  :volt_version_base => volt_version_base
99
99
  }
100
-
100
+
101
101
  return opts
102
102
  end
103
-
103
+
104
104
  def volt_version_base
105
105
  version_path = File.join(File.dirname(__FILE__), '../../../VERSION')
106
106
  File.read(version_path).split('.').tap {|v| v[v.size-1] = 0 }.join('.')
107
107
  end
108
-
108
+
109
109
  def get_constant_name
110
110
  constant_name = @name.split('_').map{|p| p[0..0].upcase + p[1..-1] }.join
111
111
  constant_name = constant_name.split('-').map{|q| q[0..0].upcase + q[1..-1] }.join('::') if constant_name =~ /-/
112
-
112
+
113
113
  return constant_name
114
114
  end
115
-
116
- end
115
+
116
+ end
data/lib/volt/cli.rb CHANGED
@@ -3,17 +3,17 @@ require 'thor'
3
3
 
4
4
  class CLI < Thor
5
5
  include Thor::Actions
6
-
6
+
7
7
  desc "new PROJECT_NAME", "generates a new project."
8
8
  def new(name)
9
9
  # Grab the current volt version
10
10
  version = File.read(File.join(File.dirname(__FILE__), '../../VERSION'))
11
11
  directory("project", name, {version: version, name: name})
12
-
12
+
13
13
  say "Bundling Gems...."
14
14
  `cd #{name} ; bundle -j 4`
15
15
  end
16
-
16
+
17
17
  desc "console", "run the console on the project in the current directory"
18
18
  def console
19
19
  require 'volt/console'
@@ -38,21 +38,21 @@ class CLI < Thor
38
38
 
39
39
  ENV['SERVER'] = 'true'
40
40
  args = ['start', '--threaded', '--max-persistent-conns', '300', "--max-conns", "400"]
41
-
41
+
42
42
  if options[:port]
43
43
  args += ['-p', options[:port].to_s]
44
44
  end
45
-
45
+
46
46
  Thin::Runner.new(args).run!
47
-
47
+
48
48
  # require 'volt/server'
49
- #
49
+ #
50
50
  # EM.run do
51
51
  # thin = Rack::Handler.get("thin")
52
52
  # thin.run(Server.new.app, Port: 3000)
53
53
  # end
54
54
  end
55
-
55
+
56
56
  desc "gem GEM", "Creates a component gem where you can share a component"
57
57
  method_option :bin, :type => :boolean, :default => false, :aliases => '-b', :banner => "Generate a binary for your library."
58
58
  method_option :test, :type => :string, :lazy_default => 'rspec', :aliases => '-t', :banner => "Generate a test directory for your library: 'rspec' is the default, but 'minitest' is also supported."
@@ -62,15 +62,17 @@ class CLI < Thor
62
62
  :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
63
63
  def gem(name)
64
64
  require 'volt/cli/new_gem'
65
-
65
+
66
66
  NewGem.new(self, name, options)
67
- end
68
-
67
+ end
68
+
69
69
  def self.source_root
70
70
  File.expand_path(File.join(File.dirname(__FILE__), '../../templates'))
71
71
  end
72
72
  end
73
73
 
74
+ # Add in more features
75
+ require 'volt/cli/asset_compile'
74
76
 
75
77
  puts "Volt #{File.read(File.join(File.dirname(__FILE__), "../../VERSION"))}"
76
- CLI.start(ARGV)
78
+ CLI.start(ARGV)
data/lib/volt/console.rb CHANGED
@@ -7,15 +7,14 @@ class Console
7
7
 
8
8
  require 'volt'
9
9
  require 'volt/models'
10
- require 'volt/server/template_parser'
11
10
  require 'volt'
12
11
  require 'volt/page/page'
13
12
  require 'volt/server/rack/component_paths'
14
13
  require 'volt/server/socket_connection_handler_stub'
15
-
14
+
16
15
  SocketConnectionHandlerStub.dispatcher = Dispatcher.new
17
-
18
-
16
+
17
+
19
18
  app_path = File.expand_path(File.join(Dir.pwd, "app"))
20
19
  component_paths = ComponentPaths.new
21
20
  component_paths.require_in_components
@@ -24,7 +23,7 @@ class Console
24
23
 
25
24
  # start a REPL session
26
25
  # Pry.start
27
-
26
+
28
27
  Page.new.pry
29
28
  end
30
- end
29
+ end
@@ -1,39 +1,39 @@
1
- class ModelController
1
+ class ModelController
2
2
  def self.model(val)
3
3
  @@default_model = val
4
4
  end
5
-
5
+
6
6
  # Sets the current model on this controller
7
7
  def model(val)
8
- if val.is_a?(Symbol) || val.is_a?(String)
8
+ if Symbol === val || String === val
9
9
  collections = [:page, :store, :params]
10
10
  if collections.include?(val.to_sym)
11
11
  @model = self.send(val)
12
12
  else
13
13
  raise "#{val} is not the name of a valid model, choose from: #{collections.join(', ')}"
14
14
  end
15
- elsif model
16
- @model = model
15
+ elsif val
16
+ @model = val
17
17
  else
18
- raise "model can not be #{model.inspect}"
18
+ raise "model can not be #{val.inspect}"
19
19
  end
20
20
  end
21
-
21
+
22
22
  def self.new(*args, &block)
23
23
  inst = self.allocate
24
24
  if @@default_model
25
25
  inst.model(@@default_model || :page)
26
26
  end
27
-
27
+
28
28
  inst.initialize(*args, &block)
29
-
29
+
30
30
  return inst
31
31
  end
32
-
32
+
33
33
  def page
34
34
  $page.page
35
35
  end
36
-
36
+
37
37
  def paged
38
38
  $page.page
39
39
  end
@@ -47,26 +47,26 @@ class ModelController
47
47
  end
48
48
 
49
49
  def params
50
- $page.params
50
+ $page.params
51
51
  end
52
52
 
53
53
  def url
54
- $page.url
54
+ $page.url
55
55
  end
56
-
56
+
57
57
  def channel
58
58
  $page.channel
59
59
  end
60
-
60
+
61
61
  def tasks
62
62
  $page.tasks
63
63
  end
64
-
64
+
65
65
  def controller
66
66
  @controller ||= ReactiveValue.new(Model.new)
67
67
  end
68
68
 
69
69
  def method_missing(method_name, *args, &block)
70
- return @model.send(method_name, *args, &block)
70
+ return @model.send(method_name, *args, &block)
71
71
  end
72
- end
72
+ end
@@ -4,16 +4,16 @@ class Array
4
4
  self.each do |val|
5
5
  total += val
6
6
  end
7
-
7
+
8
8
  return total
9
9
  end
10
-
10
+
11
11
  def deep_cur
12
12
  new_array = []
13
13
  each do |item|
14
14
  new_array << item.deep_cur
15
15
  end
16
-
16
+
17
17
  return new_array
18
18
  end
19
- end
19
+ end
@@ -1,11 +1,11 @@
1
1
  class Hash
2
2
  def deep_cur
3
3
  new_hash = {}
4
-
4
+
5
5
  each_pair do |key, value|
6
6
  new_hash[key.deep_cur] = value.deep_cur
7
7
  end
8
-
8
+
9
9
  return new_hash
10
10
  end
11
- end
11
+ end
@@ -1,11 +1,11 @@
1
1
  class Object
2
2
  # Setup a default pretty_inspect
3
3
  # alias_method :pretty_inspect, :inspect
4
-
4
+
5
5
  def instance_values
6
6
  Hash[instance_variables.map { |name| [name[1..-1], instance_variable_get(name)] }]
7
7
  end
8
-
8
+
9
9
  # Provides the same functionality as ||, but since ReactiveValue's only
10
10
  # work with method calls, we provide .or as a convience.
11
11
  def or(other)
@@ -15,7 +15,7 @@ class Object
15
15
  return other
16
16
  end
17
17
  end
18
-
18
+
19
19
  # Provides the same functionality as &&, but since ReactiveValue's only
20
20
  # work with method calls, we provide .and as a convience
21
21
  def and(other)
@@ -25,7 +25,7 @@ class Object
25
25
  return self
26
26
  end
27
27
  end
28
-
28
+
29
29
  def try(*a, &b)
30
30
  if a.empty? && block_given?
31
31
  yield self
@@ -33,8 +33,8 @@ class Object
33
33
  __send__(*a, &b)
34
34
  end
35
35
  end
36
-
36
+
37
37
  def deep_cur
38
38
  self.cur
39
39
  end
40
- end
40
+ end
@@ -4,11 +4,11 @@ class String
4
4
  def camelize
5
5
  self.split("_").map {|s| s.capitalize }.join("")
6
6
  end
7
-
7
+
8
8
  def underscore
9
9
  self.scan(/[A-Z][a-z]*/).join("_").downcase
10
10
  end
11
-
11
+
12
12
  def pluralize
13
13
  # TODO: Temp implementation
14
14
  if self[-1] != 's'
@@ -17,7 +17,7 @@ class String
17
17
  return self
18
18
  end
19
19
  end
20
-
20
+
21
21
  def singularize
22
22
  # TODO: Temp implementation
23
23
  if self[-1] == 's'
@@ -26,14 +26,14 @@ class String
26
26
  return self
27
27
  end
28
28
  end
29
-
29
+
30
30
  def plural?
31
31
  # TODO: Temp implementation
32
32
  self[-1] == 's'
33
33
  end
34
-
34
+
35
35
  def singular?
36
36
  # TODO: Temp implementation
37
37
  self[-1] != 's'
38
38
  end
39
- end
39
+ end
@@ -2,19 +2,19 @@ class Symbol
2
2
  def camelize
3
3
  to_s.camelize.to_sym
4
4
  end
5
-
5
+
6
6
  def underscore
7
7
  to_s.underscore.to_sym
8
8
  end
9
-
9
+
10
10
  def pluralize
11
11
  to_s.pluralize.to_sym
12
12
  end
13
-
13
+
14
14
  def singularize
15
15
  to_s.singularize.to_sym
16
16
  end
17
-
17
+
18
18
  def plural?
19
19
  to_s.plural?
20
20
  end
@@ -22,4 +22,4 @@ class Symbol
22
22
  def singular?
23
23
  to_s.singular?
24
24
  end
25
- end
25
+ end
@@ -1,16 +1,16 @@
1
1
  class Temp1
2
2
  include Events
3
-
3
+
4
4
  attr_accessor :seconds
5
5
  def initialize
6
6
  @seconds = ReactiveValue.new(nil)
7
7
  end
8
-
8
+
9
9
  def seconds=(val)
10
10
  @seconds.cur = val
11
11
  end
12
-
12
+
13
13
  def live_seconds
14
14
  @seconds
15
15
  end
16
- end
16
+ end
@@ -6,7 +6,7 @@ class Object
6
6
  def true?
7
7
  true
8
8
  end
9
-
9
+
10
10
  def false?
11
11
  false
12
12
  end
@@ -16,7 +16,7 @@ class FalseClass
16
16
  def true?
17
17
  false
18
18
  end
19
-
19
+
20
20
  def false?
21
21
  true
22
22
  end
@@ -26,7 +26,7 @@ class NilClass
26
26
  def true?
27
27
  false
28
28
  end
29
-
29
+
30
30
  def false?
31
31
  true
32
32
  end
@@ -37,8 +37,8 @@ class Boolean
37
37
  def true?
38
38
  self
39
39
  end
40
-
40
+
41
41
  def false?
42
42
  self
43
- end
44
- end
43
+ end
44
+ end
@@ -1,31 +1,31 @@
1
1
  class Object
2
-
2
+
3
3
  class TryProxy
4
4
  def initialize(original)
5
5
  @original = original
6
6
  end
7
-
7
+
8
8
  def method_missing(method_name, *args, &block)
9
9
  if @original.respond_to?(method_name)
10
-
10
+
11
11
  else
12
12
  NilProxy.new
13
13
  end
14
14
  end
15
15
  end
16
-
16
+
17
17
  class NilProxy
18
18
  def method_missing(method_name, *args, &block)
19
19
  if @original.respond_to?(method_name)
20
-
20
+
21
21
  else
22
22
  NilProxy.new
23
23
  end
24
24
  end
25
25
  end
26
-
26
+
27
27
  def try
28
-
28
+
29
29
  end
30
-
31
- end
30
+
31
+ end