Class: Udb::Profile
- Inherits:
-
Portfolio
- Object
- DatabaseObject
- TopLevelDatabaseObject
- Portfolio
- Udb::Profile
- Defined in:
- lib/udb/obj/profile.rb
Overview
Representation of a specific profile in a profile release.
Instance Method Summary collapse
-
#base ⇒ 32, 64
The base XLEN for the profile.
- #ext_note_to_adoc(ext_name) ⇒ Array<String>
- #ext_req_to_adoc(ext_req) ⇒ Array<String>
-
#extensions_to_adoc(presence_type, heading_level) ⇒ Array<String>
Too complicated to put in profile ERB template.
-
#marketing_name ⇒ String
The marketing name of the Profile.
-
#mode ⇒ "M", ...
Privilege mode for the profile.
-
#profile_family ⇒ ProfileFamily
The profile family this profile belongs to.
-
#profile_release ⇒ ProfileRelease
The profile release this profile belongs to.
Constructor Details
This class inherits a constructor from Udb::Portfolio
Instance Method Details
#base ⇒ 32, 64
Returns The base XLEN for the profile.
190 191 192 |
# File 'lib/udb/obj/profile.rb', line 190 def base @data["base"] end |
#ext_note_to_adoc(ext_name) ⇒ Array<String>
261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/udb/obj/profile.rb', line 261 def ext_note_to_adoc(ext_name) ret = [] unless extension_note(ext_name).nil? ret << "+" ret << "[NOTE]" ret << "--" ret << extension_note(ext_name) ret << "--" end ret end |
#ext_req_to_adoc(ext_req) ⇒ Array<String>
248 249 250 251 252 253 254 255 256 257 |
# File 'lib/udb/obj/profile.rb', line 248 def ext_req_to_adoc(ext_req) ret = [] ext = arch.extension(ext_req.name) ret << "* *#{ext_req.name}* " + (ext.nil? ? "" : ext.long_name) ret << "+" ret << "Version #{ext_req.requirement_specs_to_s}" ret end |
#extensions_to_adoc(presence_type, heading_level) ⇒ Array<String>
Too complicated to put in profile ERB template.
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/udb/obj/profile.rb', line 198 def extensions_to_adoc(presence_type, heading_level) ret = [] presence_ext_reqs = in_scope_ext_reqs(presence_type) plural = (presence_ext_reqs.size == 1) ? "" : "s" ret << "The #{marketing_name} Profile has #{presence_ext_reqs.size} #{presence_type} extension#{plural}." ret << "" unless presence_ext_reqs.empty? if (presence_type == Presence.optional) && uses_optional_types? # Iterate through each optional type. Use object version (not string) to get # precise comparisons (i.e., presence string and optional type string). Presence.optional_types_obj.each do |optional_type_obj| optional_type_ext_reqs = in_scope_ext_reqs(optional_type_obj) unless optional_type_ext_reqs.empty? ret << "" ret << ("=" * heading_level) + " #{optional_type_obj.optional_type.capitalize} Options" optional_type_ext_reqs.each do |ext_req| ret << ext_req_to_adoc(ext_req) ret << ext_note_to_adoc(ext_req.name) end # each ext_req end # unless optional_type_ext_reqs empty # Add extra notes that just belong to just this optional type. extra_notes_for_presence(optional_type_obj)&.each do |extra_note| ret << "NOTE: #{extra_note.text}" ret << "" end # each extra_note end # each optional_type_obj else # don't bother with optional types presence_ext_reqs.each do |ext_req| ret << ext_req_to_adoc(ext_req) ret << ext_note_to_adoc(ext_req.name) end # each ext_req end # checking for optional types end # presence_ext_reqs isn't empty # Add extra notes that just belong to this presence. # Use object version (not string) of presence to avoid adding extra notes # already added for optional types if they are in use. extra_notes_for_presence(Presence.new(presence_type))&.each do |extra_note| ret << "NOTE: #{extra_note.text}" ret << "" end # each extra_note ret end |
#marketing_name ⇒ String
Returns The marketing name of the Profile.
171 |
# File 'lib/udb/obj/profile.rb', line 171 def marketing_name = @data["marketing_name"] |
#mode ⇒ "M", ...
Returns Privilege mode for the profile.
185 186 187 |
# File 'lib/udb/obj/profile.rb', line 185 def mode @data["mode"] end |
#profile_family ⇒ ProfileFamily
Returns The profile family this profile belongs to.
182 |
# File 'lib/udb/obj/profile.rb', line 182 def profile_family = profile_release.profile_family |
#profile_release ⇒ ProfileRelease
Returns The profile release this profile belongs to.
174 175 176 177 178 179 |
# File 'lib/udb/obj/profile.rb', line 174 def profile_release profile_release = @arch.ref(@data["release"]["$ref"]) raise "No profile release named '#{@data["release"]["$ref"]}'" if profile_release.nil? profile_release end |