Module: Milktea

Defined in:
lib/milktea.rb,
lib/milktea/text.rb,
lib/milktea/model.rb,
lib/milktea/bounds.rb,
lib/milktea/config.rb,
lib/milktea/loader.rb,
lib/milktea/message.rb,
lib/milktea/program.rb,
lib/milktea/runtime.rb,
lib/milktea/version.rb,
lib/milktea/renderer.rb,
lib/milktea/container.rb,
lib/milktea/application.rb

Overview

The Milktea TUI framework for Ruby

Defined Under Namespace

Modules: Message Classes: Application, Config, Container, Error, Loader, Model, Program, Renderer, Runtime, Text

Constant Summary collapse

MUTEX =
Mutex.new
Bounds =

Bounds represents the position and size of a UI element

Data.define(:width, :height, :x, :y) do
  def initialize(width: 0, height: 0, x: 0, y: 0) # rubocop:disable Naming/MethodParameterName
    super
  end
end
VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.appObject



16
17
18
# File 'lib/milktea.rb', line 16

def app
  MUTEX.synchronize { @app }
end

.app=(app) ⇒ Object



20
21
22
# File 'lib/milktea.rb', line 20

def app=(app)
  MUTEX.synchronize { @app = app }
end

.configObject



32
33
34
35
36
# File 'lib/milktea.rb', line 32

def config
  MUTEX.synchronize do
    @config ||= Config.new
  end
end

.configure(&block) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/milktea.rb', line 38

def configure(&block)
  MUTEX.synchronize do
    @config = if block_given?
                Config.new(&block)
              else
                Config.new
              end
  end
end

.envObject



28
29
30
# File 'lib/milktea.rb', line 28

def env
  (ENV.fetch("MILKTEA_ENV", nil) || ENV.fetch("APP_ENV", "production")).to_sym
end

.rootObject



24
25
26
# File 'lib/milktea.rb', line 24

def root
  @root ||= find_root
end