false) { $param = compact('value', 'named'); return is_callable($value) ? $this->addNested(FindValue::class, $param) : $this->addValue(FindValue::class, $param); } public function capture($value = null) { return $this->find($value); } } class FindValue { use Nested; private $hexpression; private $open; private $close; public function __construct($param) { extract($param); $this->hexpression = is_callable($value) ? new Hexpress($value) : $value; $this->open = $named ? "(?P<{$named}>" : '('; $this->close = ')'; } } class Hexpress def find(value = nil, &block) value ? add_value(Nested::Find, value) : add_nested(Nested::Find, &block) end alias_method :capture, :find module Nested class Find include Nested def initialize(value=nil,&block) @hexpression = value || Hexpress.new.instance_eval(&block) @open, @close = "(", ")" end end end end ࠷ۙͷ1)1ͳΒ͔ͳΓ࣮ʹҠ২Մೳ