Class: Rundoc::CodeCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/rundoc/code_command.rb,
lib/rundoc/code_command/raw.rb,
lib/rundoc/code_command/pipe.rb,
lib/rundoc/code_command/repl.rb,
lib/rundoc/code_command/write.rb,
lib/rundoc/code_command/rundoc/require.rb,
lib/rundoc/code_command/rundoc_command.rb,
lib/rundoc/code_command/no_such_command.rb,
lib/rundoc/code_command/rundoc/depend_on.rb

Overview

Generic CodeCommand class to be inherited

Defined Under Namespace

Modules: FileUtil Classes: Background, Bash, FileCommand, NoSuchCommand, Pipe, Raw, Repl, RundocCommand, Website, Write

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CodeCommand

Returns a new instance of CodeCommand.



12
13
# File 'lib/rundoc/code_command.rb', line 12

def initialize(*args)
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



5
6
7
# File 'lib/rundoc/code_command.rb', line 5

def command
  @command
end

#contentsObject

Returns the value of attribute contents.



5
6
7
# File 'lib/rundoc/code_command.rb', line 5

def contents
  @contents
end

#keywordObject

Returns the value of attribute keyword.



5
6
7
# File 'lib/rundoc/code_command.rb', line 5

def keyword
  @keyword
end

#original_argsObject

Returns the value of attribute original_args.



5
6
7
# File 'lib/rundoc/code_command.rb', line 5

def original_args
  @original_args
end

#render_commandObject Also known as: render_command?

Returns the value of attribute render_command.



5
6
7
# File 'lib/rundoc/code_command.rb', line 5

def render_command
  @render_command
end

#render_resultObject Also known as: render_result?

Returns the value of attribute render_result.



5
6
7
# File 'lib/rundoc/code_command.rb', line 5

def render_result
  @render_result
end

Instance Method Details

#call(env = {}) ⇒ Object

Executes command to build project Is expected to return the result of the command



31
32
33
# File 'lib/rundoc/code_command.rb', line 31

def call(env = {})
  raise "not implemented on #{self.inspect}"
end

#hidden?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/rundoc/code_command.rb', line 15

def hidden?
  !render_command? && !render_result?
end

#not_hidden?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/rundoc/code_command.rb', line 19

def not_hidden?
  !hidden?
end

#push(contents) ⇒ Object Also known as: <<



23
24
25
26
# File 'lib/rundoc/code_command.rb', line 23

def push(contents)
  @contents ||= ""
  @contents << contents
end

#to_md(env = {}) ⇒ Object

the output of the command, i.e. ‘$ cat foo.txt`



36
37
38
# File 'lib/rundoc/code_command.rb', line 36

def to_md(env = {})
  raise "not implemented on #{self.inspect}"
end