Class: Fatty::ActionEnvironment

Inherits:
Object
  • Object
show all
Defined in:
lib/fatty/action_environment.rb

Overview

For holding the environment in which an action is executed

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session: nil, terminal: nil, counter: nil, event: nil, buffer: nil, field: nil, pager: nil) ⇒ ActionEnvironment

Returns a new instance of ActionEnvironment.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fatty/action_environment.rb', line 8

def initialize(
  session: nil,
  terminal: nil,
  counter: nil,
  event: nil,
  buffer: nil,
  field: nil,
  pager: nil
)
  @session = session
  @terminal = terminal
  @counter = counter
  @event = event
  @buffer = buffer
  @field = field
  @pager = pager
end

Instance Attribute Details

#bufferObject

Returns the value of attribute buffer.



6
7
8
# File 'lib/fatty/action_environment.rb', line 6

def buffer
  @buffer
end

#counterObject

Returns the value of attribute counter.



6
7
8
# File 'lib/fatty/action_environment.rb', line 6

def counter
  @counter
end

#eventObject

Returns the value of attribute event.



6
7
8
# File 'lib/fatty/action_environment.rb', line 6

def event
  @event
end

#fieldObject

Returns the value of attribute field.



6
7
8
# File 'lib/fatty/action_environment.rb', line 6

def field
  @field
end

#pagerObject

Returns the value of attribute pager.



6
7
8
# File 'lib/fatty/action_environment.rb', line 6

def pager
  @pager
end

#sessionObject

Returns the value of attribute session.



6
7
8
# File 'lib/fatty/action_environment.rb', line 6

def session
  @session
end

Instance Method Details

#terminalObject



26
27
28
# File 'lib/fatty/action_environment.rb', line 26

def terminal
  session&.terminal
end

#to_sObject



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fatty/action_environment.rb', line 30

def to_s
  parts = []
  parts << "session: #{session}" if session
  parts << "terminal: #{terminal}" if terminal
  parts << "counter: #{counter}" if counter
  parts << "event: #{event.to_s[0..90]}" if event
  parts << "buffer: #{buffer}" if buffer
  parts << "field: #{field}" if field
  parts << "pager: #{pager}" if pager
  parts.join('; ')
end