roda-component 0.1.32 → 0.1.33

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ebd6f0139e53a87721af0a4243f0bf8f7204c006
4
- data.tar.gz: 8687918303e9219d7e27b63ec095137ab9955919
3
+ metadata.gz: 4fcaa4c0679c09e6a9069c746125953d2b99ff0a
4
+ data.tar.gz: 371d39e0be53e7a81630ab70da3c4b2729c65218
5
5
  SHA512:
6
- metadata.gz: 9a4c6fc2ebf51ca861d11d4d8313ff7d5c16e9f4a7f56712c9f66b4e2240608faff849399fd75598af9e753a87f24e73ff6754463ef5d255e346cb4591928d0a
7
- data.tar.gz: b9e1b5ef676984dd8fca2a218bffd45138f95cb50023beaa58955c970cb2b205c7cf474d0e5f0c4dc52ef742d19e47a1f0d0bd92a68005359affb5de7f32c864
6
+ metadata.gz: 00b04cc7fb8befcc3d4539bac1659301df76124f18f4ee4a87f9bc164bd103769016e27fc3fea1b528d6f5a53035cfd16e205c09457cf0d5853d7dabad415822
7
+ data.tar.gz: db05cde6ce3cf267299e9ae88a3dc342b607a86f350302bb706120518ce251171089e383d281c698b4a616dd847089298dbd2407450b09977fab7ccc8ae4a003
@@ -1,5 +1,5 @@
1
1
  class Roda
2
2
  class Component
3
- VERSION = "0.1.32"
3
+ VERSION = "0.1.33"
4
4
  end
5
5
  end
@@ -368,6 +368,24 @@ class Roda
368
368
  events.trigger(*args)
369
369
  end
370
370
 
371
+ def function *args, &block
372
+ args.any? && raise(ArgumentError, '`function` does not accept arguments')
373
+ block || raise(ArgumentError, 'block required')
374
+ proc do |*a|
375
+ a.map! {|x| Native(`x`)}
376
+ @this = Native(`this`)
377
+ %x{
378
+ var bs = block.$$s,
379
+ result;
380
+ block.$$s = null;
381
+ result = block.apply(self, a);
382
+ block.$$s = bs;
383
+
384
+ return result;
385
+ }
386
+ end
387
+ end
388
+
371
389
  def method_missing method, *args, &block
372
390
  if server? && scope.respond_to?(method, true)
373
391
  scope.send method, *args, &block
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roda-component
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.32
4
+ version: 0.1.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - cj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-05 00:00:00.000000000 Z
11
+ date: 2015-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal