sudojs-rails 0.3.0 → 0.3.1

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.
@@ -14,11 +14,13 @@ module Sudojs
14
14
  # be considered 'custom' classes
15
15
  @class_names = {
16
16
  'Base' => '_.Base',
17
+ 'Model' => '_.Model',
17
18
  'Container' => '_.Container',
18
19
  'DataView' => '_.DataView',
19
20
  'View' => '_.View',
20
21
  'ViewController' => '_.ViewController'
21
22
  }
23
+ debugger
22
24
  ary = route.split('#')
23
25
  @c_name = ary[0]
24
26
  @c_camel = camelize(@c_name)
@@ -26,14 +28,14 @@ module Sudojs
26
28
  @is_application = @c_name == 'application'
27
29
  # 'action' name not always applicable but thats ok
28
30
  @a_name = ary[1]
29
- @a_camel = camelize(@a_name)
30
- # class invocations with `new` should always use a proper name
31
- @a_pascal = @a_camel.capitalize
31
+ @a_camel = camelize @a_name
32
+ # class invocations with `new` should always use a PascalCased name
33
+ @a_pascal = pascalize @a_name
32
34
  # either inherits from a sudo.js class or a custom one
33
35
  @parent = @class_names[name] || name
34
36
  # the arguments vary in the templates for class types
35
37
  if @parent
36
- if @parent == '_.Base' || @parent == '_.Container'
38
+ if @parent == '_.Base' || @parent == '_.Model' || @parent == '_.Container'
37
39
  @args = 'data'
38
40
  else
39
41
  @args = 'el, data'
@@ -44,8 +44,16 @@ module Sudojs
44
44
  end
45
45
 
46
46
  def pascalize(what)
47
- n = camelize(what)
48
- n.capitalize
47
+ # wow, capitalize will downcase a camel-cased word - fail
48
+ if what.include? '_'
49
+ ary = what.split '_'
50
+ ary.each {|val|
51
+ val.capitalize!
52
+ }
53
+ ary.join('')
54
+ else
55
+ what
56
+ end
49
57
  end
50
58
 
51
59
  end
@@ -2,7 +2,7 @@
2
2
  class <%= name %>.Model extends _.Model
3
3
  constructor: (data) ->
4
4
  super data
5
- $.extend @, _.ext.observable
5
+ $.extend @, _.extensions.observable
6
6
 
7
7
  # attach the model to the <%= name %> namespace
8
8
  <%= name %>.model = new <%= name %>.Model()
@@ -1,7 +1,7 @@
1
1
  // Global model is a sudo.Observable
2
2
  <%= name %>.Model = function(data) {
3
3
  this.construct(data);
4
- $.extend(this, _.ext.observable);
4
+ $.extend(this, _.extensions.observable);
5
5
  };
6
6
  // `private`
7
7
  <%= name %>.Model.prototype = Object.create(_.Model.prototype);
@@ -1,3 +1,3 @@
1
1
  module Sudojs
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sudojs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-02 00:00:00.000000000 Z
12
+ date: 2013-02-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -78,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  segments:
80
80
  - 0
81
- hash: -2092482263484943963
81
+ hash: 1452095784062017175
82
82
  required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  segments:
89
89
  - 0
90
- hash: -2092482263484943963
90
+ hash: 1452095784062017175
91
91
  requirements: []
92
92
  rubyforge_project:
93
93
  rubygems_version: 1.8.24