class RocketDocs::Documentation::Controller

Attributes

actions[R]
documentation[R]
file[RW]
name[RW]

Public Class Methods

new(name, file, actions_hash, documentation) click to toggle source
# 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

Public Instance Methods

full_name() click to toggle source
# File lib/rocket_docs/documentation/controller.rb, line 38
def full_name
  @name
end
should_update?() click to toggle source
# File lib/rocket_docs/documentation/controller.rb, line 28
def should_update?
  return false if generate_hash == @file_md5
  true
end
update() click to toggle source
# File lib/rocket_docs/documentation/controller.rb, line 19
def update
  should_update? && update!
end
update!() click to toggle source
# File lib/rocket_docs/documentation/controller.rb, line 23
def update!
  @file_md5 = generate_hash
  generate
end

Private Instance Methods

generate() click to toggle source
# File lib/rocket_docs/documentation/controller.rb, line 44
def generate
  @actions = []
  comments = RocketDocs::Parser.method_comments(file)
  @actions_in.each do |name, action|
    @actions << Action.new(name, comments[name], action[:methods], action[:params], self)
  end
end
generate_hash() click to toggle source
# File lib/rocket_docs/documentation/controller.rb, line 52
def generate_hash
  # Digest::MD5.file(file).hexdigest
end