Class: RocketDocs::Documentation::Controller

Inherits:
Object
  • Object
show all
Defined in:
lib/rocket_docs/documentation/controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, file, actions_hash, documentation) ⇒ Controller

Returns a new instance of Controller.



9
10
11
12
13
14
15
16
17
# File 'lib/rocket_docs/documentation/controller.rb', line 9

def initialize(name, file, actions_hash, documentation)
  @file_md5  = ''
  @actions = []
  @actions_in = actions_hash
  self.name = name
  self.file = file
  @documentation = documentation
  update!
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



7
8
9
# File 'lib/rocket_docs/documentation/controller.rb', line 7

def actions
  @actions
end

#documentationObject (readonly)

Returns the value of attribute documentation.



6
7
8
# File 'lib/rocket_docs/documentation/controller.rb', line 6

def documentation
  @documentation
end

#fileObject

Returns the value of attribute file.



5
6
7
# File 'lib/rocket_docs/documentation/controller.rb', line 5

def file
  @file
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/rocket_docs/documentation/controller.rb', line 4

def name
  @name
end

Instance Method Details

#full_nameObject



38
39
40
# File 'lib/rocket_docs/documentation/controller.rb', line 38

def full_name
  @name
end

#should_update?Boolean

Returns:

  • (Boolean)


28
29
30
31
# File 'lib/rocket_docs/documentation/controller.rb', line 28

def should_update?
  return false if generate_hash == @file_md5
  true
end

#updateObject



19
20
21
# File 'lib/rocket_docs/documentation/controller.rb', line 19

def update
  should_update? && update!
end

#update!Object



23
24
25
26
# File 'lib/rocket_docs/documentation/controller.rb', line 23

def update!
  @file_md5 = generate_hash
  generate
end