Class: WriteTask

Inherits:
Object
  • Object
show all
Includes:
TaskInterface
Defined in:
lib/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TaskInterface

#discard

Constructor Details

#initialize(name, contents, executable = false) ⇒ WriteTask

Returns a new instance of WriteTask.

Raises:

  • (ArgumentError)


87
88
89
90
91
92
# File 'lib/task.rb', line 87

def initialize(name, contents, executable = false)
  raise ArgumentError, "name and contents must be given" if name.nil? || contents.nil?
  @name = name
  @contents = contents
  @executable = executable
end

Instance Attribute Details

#contentsObject (readonly)

Returns the value of attribute contents.



85
86
87
# File 'lib/task.rb', line 85

def contents
  @contents
end

#executableObject (readonly)

Returns the value of attribute executable.



85
86
87
# File 'lib/task.rb', line 85

def executable
  @executable
end

#nameObject (readonly)

Returns the value of attribute name.



85
86
87
# File 'lib/task.rb', line 85

def name
  @name
end

Instance Method Details

#generate(context_binding) ⇒ Object



94
95
96
# File 'lib/task.rb', line 94

def generate(context_binding)
  @contents
end

#output_nameObject



98
99
100
# File 'lib/task.rb', line 98

def output_name
  @name
end