Skip to content

Commit 5c9e0a9

Browse files
author
Derek Hower
committed
Improve documentation for Architecture class
1 parent c9a6743 commit 5c9e0a9

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

lib/architecture.rb

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@
1919
require_relative "arch_obj_models/portfolio"
2020
require_relative "arch_obj_models/profile"
2121

22-
# represents an entire RISC-V Architecture.
22+
# Represents the entire RISC-V Architecture.
2323
#
2424
# Could be either the standard spec (defined by RISC-V International)
25-
# of a custom spec (defined as an overlay in cfgs/)
25+
# of a custom spec (defined as an arch_overlay in cfgs/)
2626
class Architecture
2727
# @return [Pathname] Path to the directory with the standard YAML files
2828
attr_reader :path
2929

30+
# @param arch_dir [Sting,Pathname] Path to a directory with a fully merged/resolved architecture defintion
3031
def initialize(arch_dir)
3132
@arch_dir = Pathname.new(arch_dir)
3233
raise "Arch directory not found: #{arch_dir}" unless @arch_dir.exist?
@@ -37,6 +38,8 @@ def initialize(arch_dir)
3738
@object_hashes ||= {}
3839
end
3940

41+
# validate the architecture against JSON Schema and any object-specific verification
42+
# @param show_progress [Boolean] Whether to show a progress bar
4043
def validate(show_progress: true)
4144
progressbar = ProgressBar.create(total: objs.size) if show_progress
4245

@@ -263,16 +266,15 @@ def ref(uri)
263266
raise "Unhandled ref object: #{file_path}"
264267
end
265268

266-
if obj_path.nil?
267-
obj
268-
else
269-
parts = obj_path.split("/")
270-
parts.each do |part|
271-
raise "Error in $ref. There is no method '#{part}' for a #{obj.class.name}" unless obj.respond_to?(part.to_sym)
269+
unless obj_path.nil?
270+
parts = obj_path.split("/")
271+
parts.each do |part|
272+
raise "Error in $ref. There is no method '#{part}' for a #{obj.class.name}" unless obj.respond_to?(part.to_sym)
272273

273-
obj = obj.send(part)
274-
end
275-
obj
274+
obj = obj.send(part)
276275
end
276+
end
277+
278+
obj
277279
end
278280
end

0 commit comments

Comments
 (0)