roda-component 0.1.45 → 0.1.46

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: c39c23aab38d3e58a29f3ba6219547391dd786f9
4
- data.tar.gz: a1c09993e3f2bd1ffb9454a9555e0a9c9699ac39
3
+ metadata.gz: a37accc2a509987a4cc84739978f698929bb74cc
4
+ data.tar.gz: 1c60476fc587fa408012bf6565c0b142f288a5d3
5
5
  SHA512:
6
- metadata.gz: 7605b345bb3b759b63f3cb354343b08c6d4267b1ff20f9bdebfeab163c789479ab43958f33ae826546584ae9adb76c18fd544b4e96c6f14be5687d82103a72a5
7
- data.tar.gz: 06dc352dd091b618d3621063be4c842711464ff45188409b856d7eccc83f0b81831fa9dab4b1a7772b4719ce155fafba98729b2a4b9c06dfd15dc8d5c818d752
6
+ metadata.gz: 113ef63e5eb521f6a4bf282c6f721f506155e55aee3bcfa04e01864af1a135d7327808d70ae334426fa353cf70efd183bbe86843195b6b8c2a63bbf4a6530564
7
+ data.tar.gz: 82dae7f4f53186c30cc4e41a81daa1cf58455a95ebccb28aad09ea7e57ceb48cf5a4ca76d7f1cda70e7538e08daadf80ef71470aa73c749d950b7edea3f06725
@@ -126,10 +126,25 @@ class Roda
126
126
  class << self
127
127
  attr_accessor :_name
128
128
 
129
+ def file_location
130
+ @_file_location
131
+ end
132
+
129
133
  def new(*args, &block)
130
134
  obj = self.allocate
131
135
  obj.instance_variable_set :@_scope, args.shift
132
- obj.send :initialize, *args, &block
136
+
137
+ # don't send any args if none are wanted
138
+ if server?
139
+ if obj.method(:initialize).parameters.length > 0
140
+ obj.send :initialize, *args, &block
141
+ else
142
+ obj.send :initialize, &block
143
+ end
144
+ else
145
+ obj.send :initialize, *args, &block
146
+ end
147
+
133
148
  obj._initialize
134
149
  obj
135
150
  end
@@ -218,6 +233,7 @@ class Roda
218
233
  @_name = _name.to_s
219
234
 
220
235
  if server?
236
+ @_file_location = caller.first.split(':').first
221
237
  component_opts[:class_name][@_name] = self.to_s
222
238
  end
223
239
  end
@@ -1,5 +1,5 @@
1
1
  class Roda
2
2
  class Component
3
- VERSION = "0.1.45"
3
+ VERSION = "0.1.46"
4
4
  end
5
5
  end
@@ -91,9 +91,7 @@ class Roda
91
91
  comp_name = comp.class._name
92
92
  class_name = Base64.encode64 component_opts[:class_name].to_json
93
93
 
94
- file_path = comp.class.instance_methods(false).map { |m|
95
- comp.class.instance_method(m).source_location.first
96
- }.uniq.first.gsub("#{Dir.pwd}/#{component_opts[:path]}", '').gsub(/\.rb\Z/, '.js')
94
+ file_path = comp.class.file_location.gsub("#{Dir.pwd}/#{component_opts[:path]}", '').gsub(/\.rb\Z/, '.js')
97
95
 
98
96
  js = <<-EOF
99
97
  action = '#{action || 'false'}'
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.45
4
+ version: 0.1.46
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-17 00:00:00.000000000 Z
11
+ date: 2015-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal