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/write.rb,
lib/rundoc/code_command/print/erb.rb,
lib/rundoc/code_command/print/text.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, PrintERB, PrintText, Raw, RundocCommand, Website, Write

Constant Summary collapse

NEWLINE =

Newlines are stripped and re-added, this tells the project that we’re intentionally wanting an extra newline

Object.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CodeCommand

Returns a new instance of CodeCommand.



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

def initialize(*args)
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



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

def command
  @command
end

#contentsObject

Returns the value of attribute contents.



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

def contents
  @contents
end

#keywordObject

Returns the value of attribute keyword.



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

def keyword
  @keyword
end

#original_argsObject

Returns the value of attribute original_args.



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

def original_args
  @original_args
end

#render_commandObject Also known as: render_command?

Returns the value of attribute render_command.



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

def render_command
  @render_command
end

#render_resultObject Also known as: render_result?

Returns the value of attribute render_result.



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

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



42
43
44
# File 'lib/rundoc/code_command.rb', line 42

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

#hidden?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/rundoc/code_command.rb', line 26

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

#not_hidden?Boolean

Returns:

  • (Boolean)


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

def not_hidden?
  !hidden?
end

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



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

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

#to_md(env = {}) ⇒ Object

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



47
48
49
# File 'lib/rundoc/code_command.rb', line 47

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