Class: OKF::TUI::Workspace::Entry

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

Overview

One bundle in the workspace. model is nil when the directory is missing or unreadable, and error says which — so a row explains itself instead of silently vanishing from the list.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(slug:, dir:, default:, registered:) ⇒ Entry

Returns a new instance of Entry.



22
23
24
25
26
27
# File 'lib/okf/tui/workspace.rb', line 22

def initialize(slug:, dir:, default:, registered:)
  @slug = slug
  @dir = dir
  @default = default
  @registered = registered
end

Instance Attribute Details

#dirObject (readonly)

Returns the value of attribute dir.



19
20
21
# File 'lib/okf/tui/workspace.rb', line 19

def dir
  @dir
end

#errorObject

Returns the value of attribute error.



20
21
22
# File 'lib/okf/tui/workspace.rb', line 20

def error
  @error
end

#modelObject

Returns the value of attribute model.



20
21
22
# File 'lib/okf/tui/workspace.rb', line 20

def model
  @model
end

#slugObject (readonly)

Returns the value of attribute slug.



19
20
21
# File 'lib/okf/tui/workspace.rb', line 19

def slug
  @slug
end

Instance Method Details

#conceptsObject



41
42
43
# File 'lib/okf/tui/workspace.rb', line 41

def concepts
  loaded? ? model.concept_count : 0
end

#default?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/okf/tui/workspace.rb', line 29

def default?
  @default
end

#loaded?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/okf/tui/workspace.rb', line 37

def loaded?
  !model.nil?
end

#registered?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/okf/tui/workspace.rb', line 33

def registered?
  @registered
end