Class: Profile
- Inherits:
-
PortfolioInstance
- Object
- ArchDefObject
- PortfolioInstance
- Profile
- Defined in:
- lib/arch_obj_models/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.
-
#initialize(data, arch_def) ⇒ Profile
constructor
A new instance of Profile.
-
#introduction ⇒ String
The marketing name of the Profile.
- #marketing_name ⇒ Object
-
#mode ⇒ "M", ...
Privilege mode for the profile.
-
#profile_class ⇒ ProfileClass
The profile class this profile belongs to.
-
#profile_release ⇒ ProfileRelease
The profile release this profile belongs to.
-
#referenced_extensions ⇒ Array<Extension>
List of all extensions referenced by the profile.
Constructor Details
#initialize(data, arch_def) ⇒ Profile
Returns a new instance of Profile.
133 134 135 |
# File 'lib/arch_obj_models/profile.rb', line 133 def initialize(data, arch_def) super(data, arch_def) end |
Instance Method Details
#base ⇒ 32, 64
Returns The base XLEN for the profile.
158 159 160 |
# File 'lib/arch_obj_models/profile.rb', line 158 def base @data["base"] end |
#ext_note_to_adoc(ext_name) ⇒ Array<String>
232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/arch_obj_models/profile.rb', line 232 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>
219 220 221 222 223 224 225 226 227 228 |
# File 'lib/arch_obj_models/profile.rb', line 219 def ext_req_to_adoc(ext_req) ret = [] ext = arch_def.extension(ext_req.name) ret << "* *#{ext_req.name}* " + (ext.nil? ? "" : ext.long_name) ret << "+" ret << "Version #{ext_req.version_requirement}" ret end |
#extensions_to_adoc(presence_type, heading_level) ⇒ Array<String>
Too complicated to put in profile ERB template.
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/arch_obj_models/profile.rb', line 169 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 == ExtensionPresence.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). ExtensionPresence.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(ExtensionPresence.new(presence_type))&.each do |extra_note| ret << "NOTE: #{extra_note.text}" ret << "" end # each extra_note ret end |
#introduction ⇒ String
Returns The marketing name of the Profile.
138 |
# File 'lib/arch_obj_models/profile.rb', line 138 def introduction = @data["introduction"] |
#marketing_name ⇒ Object
139 |
# File 'lib/arch_obj_models/profile.rb', line 139 def marketing_name = @data["marketing_name"] |
#mode ⇒ "M", ...
Returns Privilege mode for the profile.
153 154 155 |
# File 'lib/arch_obj_models/profile.rb', line 153 def mode @data["mode"] end |
#profile_class ⇒ ProfileClass
Returns The profile class this profile belongs to.
150 |
# File 'lib/arch_obj_models/profile.rb', line 150 def profile_class = profile_release.profile_class |
#profile_release ⇒ ProfileRelease
Returns The profile release this profile belongs to.
142 143 144 145 146 147 |
# File 'lib/arch_obj_models/profile.rb', line 142 def profile_release profile_release = @arch_def.profile_release(@data["release"]) raise "No profile release named '#{@data["release"]}'" if profile_release.nil? profile_release end |
#referenced_extensions ⇒ Array<Extension>
Returns List of all extensions referenced by the profile.
163 |
# File 'lib/arch_obj_models/profile.rb', line 163 def referenced_extensions = in_scope_extensions |