lib/engine2/action.rb in engine2-1.0.3 vs lib/engine2/action.rb in engine2-1.0.4
- old
+ new
@@ -7,10 +7,14 @@
attr_reader :parent, :name, :number, :actions, :recheck_access
attr_reader :meta_proc
class << self
attr_accessor :count
+
+ def default_meta
+ Class.new(InlineMeta){meta_type :inline}
+ end
end
def initialize parent, name, meta_class, assets
Action.count += 1
@number = Action.count
@@ -44,11 +48,11 @@
result = instance_exec(*args, &SCHEMES[name])
result.instance_eval(&blk) if blk
result
end
- def define_action name, meta_class = DummyMeta, assets = {}, &blk
+ def define_action name, meta_class = Action.default_meta, assets = {}, &blk
::Kernel.raise E2Error.new("Action #{name} already defined") if @actions[name]
action = @actions[name] = Action.new(self, name, meta_class, assets)
action.*.pre_run
define_singleton_method! name do |&ablk| # forbidden list
action.instance_eval(&ablk) if ablk
@@ -57,19 +61,19 @@
action.instance_eval(&blk) if blk
action.*.action_defined
action
end
- def define_action_meta name, meta_class = DummyMeta, assets = {}, &blk
+ def define_action_meta name, meta_class = Action.default_meta, assets = {}, &blk
define_action name, meta_class, assets do
self.* &blk
end
end
- def define_action_invoke name, meta_class = DummyMeta, assets = {}, &blk
+ def define_action_invoke name, meta_class = Action.default_meta, assets = {}, &blk
define_action name, meta_class, assets do
- self.*.define_singleton_method(:invoke, &blk)
+ self.*.define_invoke &blk
end
end
def define_action_bundle name, *actions
define_singleton_method!(name) do |&blk|
@@ -99,12 +103,11 @@
method: meta.http_method,
number: a.number,
access: recheck_access ? nil : a.check_access!(handler),
recheck_access: a.recheck_access,
terminal: a.actions.empty?,
- meta: !meta.get.empty?,
- invokable: meta.invokable
+ meta: !meta.get.empty?
}
h
end
info.first[1][:default] = true unless actions.empty?
@@ -187,27 +190,9 @@
action.*.freeze_meta
true
end
::Kernel::puts "ACTIONS: #{Action.count}, Time: #{::Time.now - time}"
- # verify_action_usage
- end
-
- def verify_action_usage
- t = ::Time.now
- each_action do |action|
- meta = action.*
- model = meta.assets[:model]
- if model
- model.one_to_many_associations.each do |a|
- end
- true
- else
- true
- end
-
- end
- ::Kernel::puts "VERIFY #{::Time.now - t}"
end
def p *args
::Kernel::p *args
end
\ No newline at end of file