Module: Clientside
- Defined in:
- lib/clientside.rb
Defined Under Namespace
Modules: Accessible Classes: Middleware, NoResMiddleware
Constant Summary collapse
- GEM_DIR =
File.dirname(__FILE__)
Class Method Summary collapse
Class Method Details
.embed(objs) ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/clientside.rb', line 164 def self.(objs) objs.each do |var, obj| if not var =~ /\A[a-zA-Z_]\w*\Z/ raise ArgumentError, "invalid var name: #{var}" elsif not obj.kind_of? Accessible raise ArgumentError, "non-js-allowed object: #{obj}" end end cid = Middleware.add_pending objs.values ERB.new(File.read(GEM_DIR + '/embed.erb'), nil, '-').result(binding) end |