Module: WR::ModResourceHook
- Includes:
- ModFDCommon
- Defined in:
- lib/wrb/applications/frmdesigner/fdmodules.rb
Overview
ModToplevelHook
Constant Summary collapse
- FDAttributes =
['class', ['name','m']]
Instance Attribute Summary collapse
-
#__fd_src ⇒ Object
Returns the value of attribute __fd_src.
Instance Method Summary collapse
- #__fd_attributes__ ⇒ Object
- #__fd_get_parents_str ⇒ Object
- #__fd_get_parents_str2(child = nil) ⇒ Object
- #__fd_update_src(lns, curln, indent, s, child = nil) ⇒ Object
- #to_hsh ⇒ Object
Methods included from ModFDCommon
#__fd_delete_items_srcs, #__fd_set_items_srcs, #__hittest, index_of_src, #parse_template4out, #style2symbols
Instance Attribute Details
#__fd_src ⇒ Object
Returns the value of attribute __fd_src.
1305 1306 1307 |
# File 'lib/wrb/applications/frmdesigner/fdmodules.rb', line 1305 def __fd_src @__fd_src end |
Instance Method Details
#__fd_attributes__ ⇒ Object
1307 1308 1309 |
# File 'lib/wrb/applications/frmdesigner/fdmodules.rb', line 1307 def __fd_attributes__() FDAttributes.dup + (self.class::FDConfig[:attributes] || []) end |
#__fd_get_parents_str ⇒ Object
1322 1323 1324 1325 1326 1327 |
# File 'lib/wrb/applications/frmdesigner/fdmodules.rb', line 1322 def __fd_get_parents_str() return "_" unless respond_to?(:parent) return "_" unless parent.is_a?(Menu) ps = parent.__fd_get_parents_str ps=="_" ? "_" + parent.name.to_s : ps + "._" + parent.name.to_s end |
#__fd_get_parents_str2(child = nil) ⇒ Object
1329 1330 1331 1332 1333 1334 1335 1336 |
# File 'lib/wrb/applications/frmdesigner/fdmodules.rb', line 1329 def __fd_get_parents_str2(child=nil) s = __fd_get_parents_str() if child s=="_" ? "_#{name} " : "#{s}._#{name} " else s=='_' ? s : "#{s} " end end |
#__fd_update_src(lns, curln, indent, s, child = nil) ⇒ Object
1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 |
# File 'lib/wrb/applications/frmdesigner/fdmodules.rb', line 1338 def __fd_update_src(lns, curln, indent, s, child=nil) c0 = curln if @__fd_src # modify col, len, lsrc, lcount = @__fd_src curln = ModFDCommon.index_of_src(lns, lsrc) raise "#{self} was failed to get index of \"#{lsrc}\"" unless curln # for debugging lns.slice!(curln+1, lcount-1) if lcount.to_i > 1 ar = s.lines s0 = ar.shift s0.chomp! s0[0, 0] = "#{__fd_get_parents_str2(child)}<< " unless ar.empty? s0 << "\n" lns[curln+=1, 0] = ar curln += ar.size-1 end lsrc[col, len] = s0 @__fd_src[1] = s0.size @__fd_src[3] = ar.size + 1 else # insert new ar = s.lines s0 = ar.shift s0.chomp! s0[0, 0] = "#{indent}#{__fd_get_parents_str2(child)}<< " s0 << "\n" @__fd_src = [indent.size, s0.size-indent.size, s0, ar.size+1] s0.extend(ModFDSrcLine).binded_obj = self #; STDERR.puts lns.join lns[curln+=1, 0] = s0 #; dpp curln, lns unless ar.empty? lns[curln+=1, 0] = ar curln += ar.size-1 end end #; dpp self.name, c0, curln curln end |
#to_hsh ⇒ Object
1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 |
# File 'lib/wrb/applications/frmdesigner/fdmodules.rb', line 1311 def to_hsh() hsh = {} hsh['class'] = self.class.to_s.split('::')[1] __fd_attributes__.each{|k, tp| next if k=='class' (v = (self.__send__(k.intern) rescue nil)) || next hsh[k] = sprintf("%p", v) } hsh end |