Class: Librarian::Cli::ManifestPresenter
- Inherits:
-
Object
- Object
- Librarian::Cli::ManifestPresenter
- Defined in:
- lib/librarian/cli/manifest_presenter.rb
Instance Attribute Summary collapse
-
#cli ⇒ Object
readonly
Returns the value of attribute cli.
-
#manifests ⇒ Object
readonly
Returns the value of attribute manifests.
Instance Method Summary collapse
-
#initialize(cli, manifests) ⇒ ManifestPresenter
constructor
A new instance of ManifestPresenter.
- #present(names = [], options = { }) ⇒ Object
- #present_one(manifest, options = { }) ⇒ Object
Constructor Details
#initialize(cli, manifests) ⇒ ManifestPresenter
Returns a new instance of ManifestPresenter.
8 9 10 11 12 13 14 |
# File 'lib/librarian/cli/manifest_presenter.rb', line 8 def initialize(cli, manifests) self.cli = cli or raise ArgumentError, "cli required" self.manifests = manifests or raise ArgumentError, "manifests required" self.manifests_index = Hash[manifests.map{|m| [m.name, m]}] self.scope_level = 0 end |
Instance Attribute Details
#cli ⇒ Object
Returns the value of attribute cli.
5 6 7 |
# File 'lib/librarian/cli/manifest_presenter.rb', line 5 def cli @cli end |
#manifests ⇒ Object
Returns the value of attribute manifests.
5 6 7 |
# File 'lib/librarian/cli/manifest_presenter.rb', line 5 def manifests @manifests end |
Instance Method Details
#present(names = [], options = { }) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/librarian/cli/manifest_presenter.rb', line 16 def present(names = [], = { }) full = [:detailed] full = !names.empty? if full.nil? names = manifests.map(&:name).sort if names.empty? assert_no_manifests_missing!(names) present_each(names, :detailed => full) end |
#present_one(manifest, options = { }) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/librarian/cli/manifest_presenter.rb', line 26 def present_one(manifest, = { }) full = [:detailed] say "#{manifest.name} (#{manifest.version})" do full or next present_one_source(manifest) present_one_dependencies(manifest) end end |