poke_js 0.1.2 → 0.1.3

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.
@@ -3,24 +3,24 @@ POKE = {
3
3
  blank: function(o) {
4
4
  return typeof o === "undefined" || o === null;
5
5
  },
6
- present: function(o) {
7
- return !POKE.blank(o);
8
- },
9
- get_or_create: function(namespace, o) {
10
- if (POKE.blank(o))
11
- o = APP;
12
- if (POKE.blank(o[namespace]))
13
- o[namespace] = {};
14
- return o[namespace];
6
+ get_or_create: function(namespace_string) {
7
+ var current_namepace = window;
8
+ $.each(namespace_string.split('.'), function(index, level) {
9
+ if (POKE.blank(current_namepace[level]))
10
+ current_namepace[level] = {};
11
+ current_namepace = current_namepace[level];
12
+ });
13
+
14
+ return current_namepace;
15
15
  },
16
- define: function(namespace, hash, o) {
17
- var o_namespace = POKE.get_or_create(namespace, o);
18
- return $.extend(o_namespace, hash);
16
+ define: function(namespace_string, definition) {
17
+ var found_namespace = POKE.get_or_create(namespace_string);
18
+ return $.extend(found_namespace, definition);
19
19
  },
20
20
 
21
21
 
22
22
  exec_all: function(controller, format, action) {
23
- POKE.exec("app", format);
23
+ POKE.exec("all", format);
24
24
  POKE.exec(controller, format);
25
25
  POKE.exec(controller, format, action);
26
26
  },
@@ -44,5 +44,15 @@ POKE = {
44
44
  };
45
45
 
46
46
  if (POKE.blank(window["APP"]))
47
- APP = {};
47
+ APP = {
48
+ namespace_string: function(namespace_string) {
49
+ return "APP." + namespace_string;
50
+ },
51
+ get_or_create: function(namespace_string) {
52
+ return POKE.define(APP.namespace_string(namespace_string));
53
+ },
54
+ define: function(namespace_string, definition) {
55
+ return POKE.define(APP.namespace_string(namespace_string), definition);
56
+ }
57
+ };
48
58
  $(POKE.init);
@@ -1,3 +1,3 @@
1
1
  module PokeJs
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poke_js
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
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: 2012-12-10 00:00:00.000000000 Z
12
+ date: 2012-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails