altered Hash/Array/Detached/Persisted path system

This commit is contained in:
Administrator 2026-03-28 11:10:36 -07:00
parent c80e2ca6a5
commit 26827a4b36
6 changed files with 53 additions and 70 deletions

View file

@ -1,3 +1,4 @@
# backtick_javascript: true
# Alteration to Opal's Buffer::Array
class Buffer
class Array
@ -645,24 +646,21 @@ class Hash
end
last_container = container
end
if selector.is_a?(Symbol)
safe_key = (":" + selector.to_s)
else
safe_key = selector.to_s
end
# xxx
# if selector.is_a?(Symbol)
# safe_key = (":" + selector.to_s)
# else
# safe_key = selector.to_s
# end
# xxx
safe_key = safe_key.gsub("/","%2f")
path_stack.unshift(safe_key)
# compare the_value
found = false
if the_value.is_a?(::GxG::Database::Field)
if (the_value.content == the_object)
found = true
end
else
if (the_value == the_object)
found = true
end
end
if found
search_results << ("/" + path_stack.reverse.join("/"))
end
@ -695,9 +693,7 @@ class Hash
else
element = path_element
element = element.gsub("%2f","/")
if element[0] == ":"
element = element[(1..-1)].to_sym
end
element = element.to_sym
end
end
if element
@ -729,9 +725,7 @@ class Hash
else
selector = raw_selector
selector = selector.gsub("%2f","/")
if selector[0] == ":"
selector = selector[(1..-1)].to_sym
end
selector = selector.to_sym
end
end
if selector
@ -1036,24 +1030,21 @@ class Array
end
last_container = container
end
if selector.is_a?(Symbol)
safe_key = (":" + selector.to_s)
else
safe_key = selector.to_s
end
# xxx
# if selector.is_a?(Symbol)
# safe_key = (":" + selector.to_s)
# else
# safe_key = selector.to_s
# end
# xxx
safe_key = safe_key.gsub("/","%2f")
path_stack.unshift(safe_key)
# compare the_value
found = false
if the_value.is_a?(::GxG::Database::Field)
if (the_value.content == the_object)
found = true
end
else
if (the_value == the_object)
found = true
end
end
if found
search_results << ("/" + path_stack.reverse.join("/"))
end
@ -1090,9 +1081,7 @@ class Array
else
element = path_element
element = element.gsub("%2f","/")
if element[0] == ":"
element = element[(1..-1)].to_sym
end
element = element.to_sym
end
end
if element
@ -1124,9 +1113,7 @@ class Array
else
selector = raw_selector
selector = selector.gsub("%2f","/")
if selector[0] == ":"
selector = selector[(1..-1)].to_sym
end
selector = selector.to_sym
end
end
if selector

View file

@ -1,4 +1,4 @@
#
# backtick_javascript: true
#require 'gxg_uri'
#
module GxG

View file

@ -1080,11 +1080,7 @@ module GxG
end
last_container = container
end
if selector.is_a?(Symbol)
safe_key = (":" + selector.to_s)
else
safe_key = selector.to_s
end
safe_key.gsub!("/","%2f")
path_stack.unshift(safe_key)
# compare the_value
@ -1122,11 +1118,9 @@ module GxG
if (path_element =~ /^(?:[0-9])*[0-9](?:[0-9])*$/) == 0
element = path_element.to_i
else
element = path_element
element = path_element.to_s
element.gsub!("%2f","/")
if element[0] == ":"
element = element[(1..-1)].to_sym
end
element = element.to_sym
end
end
if element
@ -1156,11 +1150,9 @@ module GxG
if (raw_selector =~ /^(?:[0-9])*[0-9](?:[0-9])*$/) == 0
selector = raw_selector.to_i
else
selector = raw_selector
selector = raw_selector.to_s
selector.gsub!("%2f","/")
if selector[0] == ":"
selector = selector[(1..-1)].to_sym
end
selector = selector.to_sym
end
end
if selector
@ -2080,11 +2072,7 @@ module GxG
end
last_container = container
end
if selector.is_a?(Symbol)
safe_key = (":" + selector.to_s)
else
safe_key = selector.to_s
end
safe_key.gsub!("/","%2f")
path_stack.unshift(safe_key)
# compare the_value
@ -2126,11 +2114,9 @@ module GxG
if (path_element =~ /^(?:[0-9])*[0-9](?:[0-9])*$/) == 0
element = path_element.to_i
else
element = path_element
element = path_element.to_s
element.gsub!("%2f","/")
if element[0] == ":"
element = element[(1..-1)].to_sym
end
element = element.to_sym
end
end
if element
@ -2160,11 +2146,9 @@ module GxG
if (raw_selector =~ /^(?:[0-9])*[0-9](?:[0-9])*$/) == 0
selector = raw_selector.to_i
else
selector = raw_selector
selector = raw_selector.to_s
selector.gsub!("%2f","/")
if selector[0] == ":"
selector = selector[(1..-1)].to_sym
end
selector = selector.to_sym
end
end
if selector

View file

@ -1,7 +1,7 @@
# Events Section:
# backtick_javascript: true
module GxG
GXG_FEDERATION = {:title => "Untitled", :uuid => nil, :available => {}, :connections => {}}
GXG_FEDERATION = {:title => "Untitled", :uuid => nil, :access_url => nil, :available => {}, :connections => {}}
# ::GxG::SOCKET_MONITOR
module Messages
class Channel

View file

@ -132,7 +132,7 @@ module GxG
end
#
def update_appearance(data=nil)
# TODO ??
# TODO ???
end
# Selection / Processing:
def set_processor(the_type=nil, &block)

View file

@ -1927,15 +1927,22 @@ module GxG
# @param [String] parent The parent Ruby element
# @param [Hash] options Any options for the creation process
def initialize(parent, options={}, other_data={})
# ??? uuid is stored in @settings[:template]
if options.is_a?(GxG::Database::DetachedHash)
@uuid = options.uuid.to_s.to_sym
# ??? @uuid = options.uuid.to_s.to_sym
@uuid = ::GxG::uuid_generate().to_s.to_sym
if options[:title].to_s.size > 0
if options[:title].to_s.include("Untitled ")
@title = "Untitled Component #{@uuid.to_s}"
else
@title = options[:title].to_s
end
else
@title = options.title.to_s
end
else
@uuid = (options[:uuid] || ::GxG::uuid_generate()).to_s.to_sym
# ??? @uuid = (options[:uuid] || ::GxG::uuid_generate()).to_s.to_sym
@uuid = ::GxG::uuid_generate().to_s.to_sym
@title = (options[:title] || "Untitled Component #{@uuid.to_s}").to_s
end
@component = (options[:component] || :unknown).to_s.downcase.to_sym
@ -1950,6 +1957,11 @@ module GxG
@settings = {}
end
end
if options.respond_to?(:uuid)
@settings[:template] = options.uuid.to_s.to_sym
else
@settings[:template] = nil
end
#
if other_data[:application]
@application = other_data[:application]