Class: Shellfie::Frame

Inherits:
Object
  • Object
show all
Defined in:
lib/shellfie/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prompt: nil, type: nil, output: nil, delay: 0, prompt_color: nil, command_color: nil, output_color: nil, screen: nil) ⇒ Frame

Returns a new instance of Frame.



213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/shellfie/parser.rb', line 213

def initialize(prompt: nil, type: nil, output: nil, delay: 0, prompt_color: nil, command_color: nil,
               output_color: nil, screen: nil)
  @prompt = prompt
  @type = type
  @output = output
  @delay = delay
  @prompt_color = prompt_color
  @command_color = command_color
  @output_color = output_color
  @screen = screen
  freeze
end

Instance Attribute Details

#command_colorObject (readonly)

Returns the value of attribute command_color.



211
212
213
# File 'lib/shellfie/parser.rb', line 211

def command_color
  @command_color
end

#delayObject (readonly)

Returns the value of attribute delay.



211
212
213
# File 'lib/shellfie/parser.rb', line 211

def delay
  @delay
end

#outputObject (readonly)

Returns the value of attribute output.



211
212
213
# File 'lib/shellfie/parser.rb', line 211

def output
  @output
end

#output_colorObject (readonly)

Returns the value of attribute output_color.



211
212
213
# File 'lib/shellfie/parser.rb', line 211

def output_color
  @output_color
end

#promptObject (readonly)

Returns the value of attribute prompt.



211
212
213
# File 'lib/shellfie/parser.rb', line 211

def prompt
  @prompt
end

#prompt_colorObject (readonly)

Returns the value of attribute prompt_color.



211
212
213
# File 'lib/shellfie/parser.rb', line 211

def prompt_color
  @prompt_color
end

#screenObject (readonly)

Returns the value of attribute screen.



211
212
213
# File 'lib/shellfie/parser.rb', line 211

def screen
  @screen
end

#typeObject (readonly)

Returns the value of attribute type.



211
212
213
# File 'lib/shellfie/parser.rb', line 211

def type
  @type
end

Instance Method Details

#to_hObject



226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/shellfie/parser.rb', line 226

def to_h
  {
    prompt: prompt,
    type: type,
    output: output,
    delay: delay,
    prompt_color: prompt_color,
    command_color: command_color,
    output_color: output_color,
    screen: screen
  }.compact
end

#to_sObject



239
240
241
# File 'lib/shellfie/parser.rb', line 239

def to_s
  [prompt, type, output, screen, delay].compact.join("\n")
end