Sha256: 4d2677244137ae812d5aac2a608c55be99043d02ebb01963ab13d2cc1006486a
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
# frozen_string_literal: true require "pakyow/support/extension" require "pakyow/ui/recordable" module Pakyow module UI module Behavior module Recording extend Support::Extension def find_ui_presenter_for(presenter_class) if is_a?(Plugin) # Look for the presenter in the plugin first, falling back to the app. # ui_presenter_class = parent.ui_presenters.find { |klass| klass.ancestors.include?(presenter_class) } end ui_presenter_class ||= @ui_presenters.find { |klass| klass.ancestors.include?(presenter_class) } end apply_extension do # Create subclasses of each presenter, then make the subclasses recordable. # These subclasses will be used when performing a ui presentation instead # of the original presenter, but they'll behave identically! # after "initialize" do @ui_presenters = [isolated(:Presenter)].concat( state(:presenter) ).concat( state(:component).map(&:__presenter_class) ).map { |presenter_class| Class.new(presenter_class) do include Recordable end } end class_eval do attr_reader :ui_presenters end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pakyow-ui-1.0.0.rc2 | lib/pakyow/ui/behavior/recording.rb |
pakyow-ui-1.0.0.rc1 | lib/pakyow/ui/behavior/recording.rb |