opal-actioncable 0.1.0 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b15e15c592d97bcbad3d603ad05eb6a6acbdba9
4
- data.tar.gz: b90cdf94bdad8b28c8d76c88ea26afa00ecb6962
3
+ metadata.gz: 1f4d9fb8c98906c47ea42818fdcb3bbb44202edd
4
+ data.tar.gz: 72289fb9e794d34c007995829185ff8b35b1564d
5
5
  SHA512:
6
- metadata.gz: 5e74c10e87f3d60e8b2567bbb1ff0345658e940997bb4ce7542d143bf2789b85f3eb057c658d44dd93d776dc69cf67cba594996b00f46f22d7b953b9c4974ba1
7
- data.tar.gz: 9281343203e1fa512969028de28ebfbe2e3f93fcb9d66565452559431331bc15130117525b8e0272d26bb4ac429531cf9e2b7084405d7a8417008622e4b8b33d
6
+ metadata.gz: a55b3b8263767ff0f8381bf4ba08eb41f2da135a383cb335254c41b52487cb99bfb127a38286cb7a0553e3d738b66dae758d63e445223772af27f23e7a508786
7
+ data.tar.gz: 093906b04ff3c1c1f089a51f154b02ed545cb2ffa92bc08b6cc34578e4793804d818b13f159b4d6d536761b8dc4a02a0e70f86a2911a3fe7dc11bc33caa24472
data/README.md CHANGED
@@ -24,14 +24,15 @@ Or install it yourself as:
24
24
  require 'opal-actioncable'
25
25
 
26
26
  class TestChannel < ActionCable::Subscription
27
- def connected
28
- end
27
+ def connected
28
+ perform 'send', {data: 23}
29
+ end
29
30
 
30
- def disconnected
31
- end
31
+ def disconnected
32
+ end
32
33
 
33
- def received data
34
- end
34
+ def received data
35
+ end
35
36
  end
36
37
 
37
38
  consumer = ActionCable.createConsumer("/cable")
@@ -0,0 +1,4 @@
1
+ require "opal-actioncable/version"
2
+ require 'opal'
3
+
4
+ Opal.append_path File.expand_path('../../opal', __FILE__)
@@ -0,0 +1,5 @@
1
+ module Opal
2
+ module ActionCable
3
+ VERSION = "0.1.1"
4
+ end
5
+ end
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'opal/actioncable/version'
4
+ require 'opal-actioncable/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "opal-actioncable"
8
- spec.version = Opal::Actioncable::VERSION
8
+ spec.version = Opal::ActionCable::VERSION
9
9
  spec.authors = ["Jose Añasco", "Michael Sprauer"]
10
10
  spec.email = ["joseanasco1@gmail.com", "Michael@Sprauer.net"]
11
11
 
@@ -16,8 +16,8 @@ Gem::Specification.new do |spec|
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
17
  spec.bindir = "exe"
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
20
  spec.require_paths = ["lib"]
20
21
 
21
- spec.add_development_dependency "bundler", "~> 1.9"
22
- spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_dependency 'opal'
23
23
  end
File without changes
@@ -0,0 +1,23 @@
1
+ class ActionCable::Subscription
2
+ include Native::Helpers
3
+
4
+ def initialize subscriptions, params
5
+ @native = `new ActionCable.Subscription(#{subscriptions}, #{params.to_n})`
6
+ %x{Opal.defn(self.$class(), 'perform', #{@native}.perform)}
7
+
8
+ self.class.instance_methods(false).each do |method_name|
9
+ next if method_name == :perform
10
+ %x{#{@native}[method_name] = function(){
11
+ if (arguments[0] !== null && typeof arguments[0] === 'object')
12
+ arguments[0] = $scope.get('Hash').$new(arguments[0])
13
+ #{self}["$" + #{method_name}].apply(self, arguments);
14
+ }
15
+ }
16
+ end
17
+ end
18
+
19
+ def perform action, data
20
+ `#{@native}.perform(action, data)`
21
+ end
22
+
23
+ end
@@ -18,7 +18,7 @@ class ActionCable::Subscriptions
18
18
  end
19
19
 
20
20
  def create mixin, params={}
21
- params[:channel] ||= channel_name || mixin.class.name
21
+ params[:channel] ||= mixin.name
22
22
  mixin.new self, params
23
23
  end
24
24
  end
@@ -1,12 +1,7 @@
1
1
 
2
- require 'opal-actioncable/connection'
3
- require 'opal-actioncable/connection_monitor'
4
- require 'opal-actioncable/consumer'
5
- require 'opal-actioncable/subscription'
6
- require 'opal-actioncable/subscriptions'
2
+ require 'action_cable'
7
3
 
8
-
9
- module ActionCable
4
+ class ActionCable
10
5
 
11
6
  class << self
12
7
  def create_consumer url
@@ -28,4 +23,10 @@ module ActionCable
28
23
  @@default_consumer
29
24
  end
30
25
  end
31
- end
26
+ end
27
+
28
+ require 'action_cable/connection'
29
+ require 'action_cable/connection_monitor'
30
+ require 'action_cable/consumer'
31
+ require 'action_cable/subscription'
32
+ require 'action_cable/subscriptions'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-actioncable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Añasco
@@ -12,33 +12,19 @@ cert_chain: []
12
12
  date: 2016-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: bundler
15
+ name: opal
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '1.9'
21
- type: :development
20
+ version: '0'
21
+ type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '1.9'
28
- - !ruby/object:Gem::Dependency
29
- name: rake
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - "~>"
33
- - !ruby/object:Gem::Version
34
- version: '10.0'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - "~>"
40
- - !ruby/object:Gem::Version
41
- version: '10.0'
27
+ version: '0'
42
28
  description: Bring all the ActionCable goodness back to the ruby language
43
29
  email:
44
30
  - joseanasco1@gmail.com
@@ -54,15 +40,15 @@ files:
54
40
  - Rakefile
55
41
  - bin/console
56
42
  - bin/setup
57
- - lib/opal/actioncable.rb
58
- - lib/opal/actioncable/version.rb
43
+ - lib/opal-actioncable.rb
44
+ - lib/opal-actioncable/version.rb
59
45
  - opal-actioncable.gemspec
46
+ - opal/action_cable/connection.rb
47
+ - opal/action_cable/connection_monitor.rb
48
+ - opal/action_cable/consumer.rb
49
+ - opal/action_cable/subscription.rb
50
+ - opal/action_cable/subscriptions.rb
60
51
  - opal/opal-actioncable.rb
61
- - opal/opal-actioncable/connection.rb
62
- - opal/opal-actioncable/connection_monitor.rb
63
- - opal/opal-actioncable/consumer.rb
64
- - opal/opal-actioncable/subscription.rb
65
- - opal/opal-actioncable/subscriptions.rb
66
52
  homepage: https://github.com/MichaelSp/opal-actioncable
67
53
  licenses: []
68
54
  metadata: {}
@@ -1,4 +0,0 @@
1
- require "opal/actioncable/version"
2
- require 'opal'
3
-
4
- Opal.append_path File.expand_path('../../../opal', __FILE__)
@@ -1,5 +0,0 @@
1
- module Opal
2
- module Actioncable
3
- VERSION = "0.1.0"
4
- end
5
- end
@@ -1,13 +0,0 @@
1
- class ActionCable::Subscription
2
- include Native::Helpers
3
-
4
- def initialize subscriptions, params
5
- @native = `new ActionCable.Subscription(#{subscriptions}, #{params.to_n})`
6
- %x{Opal.defn(self.$class(), 'perform', #{@native}.perform)}
7
- end
8
-
9
- def perform action, data
10
- @native.perform action, data
11
- end
12
-
13
- end