Class: PuppetStrings::Yard::Parsers::JSON::TaskStatement

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet-strings/yard/parsers/json/task_statement.rb

Overview

Represents the Puppet Task statement.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json, source, file) ⇒ TaskStatement

Returns a new instance of TaskStatement.



8
9
10
11
12
13
14
15
# File 'lib/puppet-strings/yard/parsers/json/task_statement.rb', line 8

def initialize(json, source, file)
  @file = file
  @source = source
  @json = json
  @line = 0
  @comments_range = nil
  @docstring = YARD::Docstring.new(@json['description'])
end

Instance Attribute Details

#comments_rangeObject (readonly)

Returns the value of attribute comments_range.



6
7
8
# File 'lib/puppet-strings/yard/parsers/json/task_statement.rb', line 6

def comments_range
  @comments_range
end

#docstringObject (readonly)

Returns the value of attribute docstring.



6
7
8
# File 'lib/puppet-strings/yard/parsers/json/task_statement.rb', line 6

def docstring
  @docstring
end

#fileObject (readonly)

Returns the value of attribute file.



6
7
8
# File 'lib/puppet-strings/yard/parsers/json/task_statement.rb', line 6

def file
  @file
end

#jsonObject (readonly)

Returns the value of attribute json.



6
7
8
# File 'lib/puppet-strings/yard/parsers/json/task_statement.rb', line 6

def json
  @json
end

#lineObject (readonly)

Returns the value of attribute line.



6
7
8
# File 'lib/puppet-strings/yard/parsers/json/task_statement.rb', line 6

def line
  @line
end

#sourceObject (readonly)

Returns the value of attribute source.



6
7
8
# File 'lib/puppet-strings/yard/parsers/json/task_statement.rb', line 6

def source
  @source
end

Instance Method Details

#commentsObject



29
30
31
# File 'lib/puppet-strings/yard/parsers/json/task_statement.rb', line 29

def comments
  docstring.all
end

#comments_hash_flagObject



21
22
23
# File 'lib/puppet-strings/yard/parsers/json/task_statement.rb', line 21

def comments_hash_flag
  false
end

#nameObject



33
34
35
# File 'lib/puppet-strings/yard/parsers/json/task_statement.rb', line 33

def name
  File.basename(@file).gsub('.json', '') || ''
end

#parametersObject



17
18
19
# File 'lib/puppet-strings/yard/parsers/json/task_statement.rb', line 17

def parameters
  json['parameters'] || {}
end

#showObject



25
26
27
# File 'lib/puppet-strings/yard/parsers/json/task_statement.rb', line 25

def show
  ''
end