Class: OKF::TUI::Workspace::Group

Inherits:
Object
  • Object
show all
Defined in:
lib/okf/tui/workspace.rb

Overview

One registry group (okf 1.12): a slug naming a list of members — bundle or group slugs, so they nest — which resolves recursively, path-deduped, to bundle leaves.

members is what the registry file says, verbatim, and bundles is what okf resolved it to. Both are shown, because they answer different questions: the members are what an edit would change, the leaves are what a search would cover, and for a nested group those are not the same list.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(slug:, members:, bundles:, cyclic:, link: nil) ⇒ Group

Returns a new instance of Group.



65
66
67
68
69
70
71
# File 'lib/okf/tui/workspace.rb', line 65

def initialize(slug:, members:, bundles:, cyclic:, link: nil)
  @slug = slug
  @members = members
  @bundles = bundles
  @cyclic = cyclic
  @link = link
end

Instance Attribute Details

#bundlesObject (readonly)

Returns the value of attribute bundles.



63
64
65
# File 'lib/okf/tui/workspace.rb', line 63

def bundles
  @bundles
end

Returns the value of attribute link.



63
64
65
# File 'lib/okf/tui/workspace.rb', line 63

def link
  @link
end

#membersObject (readonly)

Returns the value of attribute members.



63
64
65
# File 'lib/okf/tui/workspace.rb', line 63

def members
  @members
end

#slugObject (readonly)

Returns the value of attribute slug.



63
64
65
# File 'lib/okf/tui/workspace.rb', line 63

def slug
  @slug
end

Instance Method Details

#cyclic?Boolean

A hand-edited registry can name a cycle, which okf reports by declining to resolve rather than by looping. Nothing here can repair it, so the row says so and refuses to be scoped — the alternative is a group that silently covers no bundles.

Returns:

  • (Boolean)


84
85
86
# File 'lib/okf/tui/workspace.rb', line 84

def cyclic?
  @cyclic
end

#linked?Boolean

A group an okf registry link brought in — the link's own set, or one the linked file curates. Scopable and searchable like any other; writable by nobody here, since okf persists only the groups this registry owns.

Returns:

  • (Boolean)


76
77
78
# File 'lib/okf/tui/workspace.rb', line 76

def linked?
  !@link.nil?
end

#sizeObject



88
89
90
# File 'lib/okf/tui/workspace.rb', line 88

def size
  bundles.length
end