vertebra 0.1.2 → 0.1.3

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: 4dd9258b8b224cd0513400c8a8ea83fe43362a2d
4
- data.tar.gz: d1a97fcd7ff3e7b1a55468f40ee139f574c432c9
3
+ metadata.gz: aee5b797d2e144c38249699d73cac501a73861ad
4
+ data.tar.gz: 2c21ed65b76242c82d32e3d28c700692e867b920
5
5
  SHA512:
6
- metadata.gz: 1b79a24e376ece8a56e91ddcff79da0b46f125b0a56d867470ff8218a3b5cdd4972c4b269071de0daab47e459b3644439357f3fe2bad07089e73693527bb05b0
7
- data.tar.gz: 81d8ac00f05c7d18c5cf28201da010165c02fb4d5ec8e58a80ccd48b719093bef421249f5ec0272e38b64f8b84748ce503dad655f5cc96b71f3c29aa1a0be50e
6
+ metadata.gz: 21a54bd20537667b1a70ada63d1931011261aa740aba0bc10255bb587bb72a4aac70cf84887c99faa4c9245f51951908290f8e2bf0090c7e26af68b6c82536b9
7
+ data.tar.gz: d3424595ead0de486f4cac96edb8b256f56f8419185c03b2eb4289d1d88125b2741f8e611e4b31d326f077c6d9cafe4883e4c7342b4f7e3db582469542842329
@@ -15,6 +15,9 @@ delegateEventSplitter = /^(\S+)\s*(.*)$/
15
15
  @trim = (str) ->
16
16
  str.replace(/^\s+|\s+$/g, '')
17
17
 
18
+ @isFunction = (obj) ->
19
+ !!(obj and obj.constructor and obj.call and obj.apply)
20
+
18
21
  _now = Date.now || -> new Date().getTime()
19
22
 
20
23
  # Throttle function borrowed from underscore.js
@@ -72,10 +75,12 @@ class Vertebra.View
72
75
  @delegateEvents()
73
76
 
74
77
  delegateEvents: ->
75
- return unless @events
76
78
  @_undelegateEvents()
79
+ return unless @events
80
+
81
+ events = if isFunction(@events) then @events() else @events
77
82
 
78
- for key, method of @events
83
+ for key, method of events
79
84
  method = @[method]
80
85
  continue unless method
81
86
  match = key.match(delegateEventSplitter)
@@ -1,3 +1,3 @@
1
1
  module Vertebra
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vertebra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - vala
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-29 00:00:00.000000000 Z
11
+ date: 2017-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails