Module: Yast::AutoinstallCommonInclude
- Defined in:
- ../../src/include/autoinstall/common.rb
Instance Method Summary (collapse)
- - (Object) addDialog(name, dialog)
-
- (Object) addPrefix(s, prefix)
seems a bit over eager to supply this, but for consistencies sake…
- - (Object) callDialogFunction(dialog, function)
-
- (Object) eventHandled
Called by event handles to indicate the current event has been handled.
- - (Object) getDialog(dialogType)
-
- (Object) getTypePrefix(item)
extracts type from tree item id strings: “part_2_0” -> “part”.
- - (Object) initialize_autoinstall_common(include_target)
- - (Object) prepareStack
-
- (Object) removePrefix(s, prefix)
TODO: might be optimized by not using a regex here.
- - (Object) string2symbol(s)
-
- (Object) stripTypePrefix(item)
strips off type prefixes from tree item id strings: “part_2_0” -> “2_0”.
- - (Object) symbol2string(s)
- - (Object) toItemList(sList)
- - (Object) updateCurrentDialog(dialogType)
Instance Method Details
- (Object) addDialog(name, dialog)
31 32 33 34 35 36 |
# File '../../src/include/autoinstall/common.rb', line 31 def addDialog(name, dialog) dialog = deep_copy(dialog) @dialogs = Builtins.add(@dialogs, name, dialog) nil end |
- (Object) addPrefix(s, prefix)
seems a bit over eager to supply this, but for consistencies sake...
130 131 132 |
# File '../../src/include/autoinstall/common.rb', line 130 def addPrefix(s, prefix) Ops.add(prefix, s) end |
- (Object) callDialogFunction(dialog, function)
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File '../../src/include/autoinstall/common.rb', line 70 def callDialogFunction(dialog, function) dialog = deep_copy(dialog) functionTerm = Ops.get(dialog, function) if nil != functionTerm Builtins.y2milestone( "calling function: '%1'->'%2'.", Ops.get_string(dialog, :type, "Unknown"), functionTerm ) # prepareStack(); Builtins.eval(functionTerm) else Builtins.y2milestone( "Function not found: '%1'->'%2'.", Ops.get_string(dialog, :type, "Unknown"), function ) end nil end |
- (Object) eventHandled
Called by event handles to indicate the current event has been handled
94 95 96 97 98 |
# File '../../src/include/autoinstall/common.rb', line 94 def eventHandled @currentEvent = {} nil end |
- (Object) getDialog(dialogType)
58 59 60 |
# File '../../src/include/autoinstall/common.rb', line 58 def getDialog(dialogType) Ops.get(@dialogs, dialogType, {}) end |
- (Object) getTypePrefix(item)
extracts type from tree item id strings: "part_2_0" -> "part"
102 103 104 105 106 107 |
# File '../../src/include/autoinstall/common.rb', line 102 def getTypePrefix(item) if nil != item && "" != item return Builtins.substring(item, 0, Builtins.findfirstof(item, "_")) end item end |
- (Object) initialize_autoinstall_common(include_target)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File '../../src/include/autoinstall/common.rb', line 11 def initialize_autoinstall_common(include_target) textdomain "autoinst" Yast.include include_target, "autoinstall/types.rb" Yast.import "AutoinstStorage" @currentDialog = {} # because i don't know how to pass arguments to eval() # i use this global map as a stack @stack = {} @currentEvent = {} @replacement_point = :rp # Global dialogs map. See StorageDialog() for more detailed # description of the general architecture. @dialogs = {} end |
- (Object) prepareStack
62 63 64 65 66 67 |
# File '../../src/include/autoinstall/common.rb', line 62 def prepareStack # TODO: implement. Builtins.y2milestone("prepareStack(): NOT IMPLEMENTED") nil end |
- (Object) removePrefix(s, prefix)
TODO: might be optimized by not using a regex here
122 123 124 125 126 127 |
# File '../../src/include/autoinstall/common.rb', line 122 def removePrefix(s, prefix) result = "" result = Builtins.regexpsub(s, Ops.add(prefix, "(.*)"), "\\1") return s if nil == result result end |
- (Object) string2symbol(s)
42 43 44 |
# File '../../src/include/autoinstall/common.rb', line 42 def string2symbol(s) Builtins.symbolof(Builtins.toterm(s)) end |
- (Object) stripTypePrefix(item)
strips off type prefixes from tree item id strings: "part_2_0" -> "2_0"
111 112 113 114 115 116 117 118 119 |
# File '../../src/include/autoinstall/common.rb', line 111 def stripTypePrefix(item) if nil != item && "" != item return Builtins.substring( item, Ops.add(Builtins.findfirstof(item, "_"), 1) ) end item end |
- (Object) symbol2string(s)
38 39 40 41 |
# File '../../src/include/autoinstall/common.rb', line 38 def symbol2string(s) return "" if nil == s Builtins.substring(Builtins.tostring(s), 1) end |
- (Object) toItemList(sList)
46 47 48 49 |
# File '../../src/include/autoinstall/common.rb', line 46 def toItemList(sList) sList = deep_copy(sList) Builtins.maplist(sList) { |s| Item(Id(string2symbol(s)), s) } end |
- (Object) updateCurrentDialog(dialogType)
52 53 54 55 |
# File '../../src/include/autoinstall/common.rb', line 52 def updateCurrentDialog(dialogType) @currentDialog = Ops.get(@dialogs, dialogType, {}) deep_copy(@currentDialog) end |