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) ⇒ Frame

Returns a new instance of Frame.



152
153
154
155
156
157
158
159
160
161
162
# File 'lib/shellfie/parser.rb', line 152

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

Instance Attribute Details

#command_colorObject (readonly)

Returns the value of attribute command_color.



150
151
152
# File 'lib/shellfie/parser.rb', line 150

def command_color
  @command_color
end

#delayObject (readonly)

Returns the value of attribute delay.



150
151
152
# File 'lib/shellfie/parser.rb', line 150

def delay
  @delay
end

#outputObject (readonly)

Returns the value of attribute output.



150
151
152
# File 'lib/shellfie/parser.rb', line 150

def output
  @output
end

#output_colorObject (readonly)

Returns the value of attribute output_color.



150
151
152
# File 'lib/shellfie/parser.rb', line 150

def output_color
  @output_color
end

#promptObject (readonly)

Returns the value of attribute prompt.



150
151
152
# File 'lib/shellfie/parser.rb', line 150

def prompt
  @prompt
end

#prompt_colorObject (readonly)

Returns the value of attribute prompt_color.



150
151
152
# File 'lib/shellfie/parser.rb', line 150

def prompt_color
  @prompt_color
end

#typeObject (readonly)

Returns the value of attribute type.



150
151
152
# File 'lib/shellfie/parser.rb', line 150

def type
  @type
end

Instance Method Details

#to_hObject



164
165
166
167
168
169
170
171
172
173
174
# File 'lib/shellfie/parser.rb', line 164

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

#to_sObject



176
177
178
# File 'lib/shellfie/parser.rb', line 176

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