Class: Steep::Project::SignatureFile

Inherits:
Object
  • Object
show all
Defined in:
lib/steep/project/file.rb

Defined Under Namespace

Classes: DeclarationsStatus, ParseErrorStatus

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:) ⇒ SignatureFile

Returns a new instance of SignatureFile.



134
135
136
137
# File 'lib/steep/project/file.rb', line 134

def initialize(path:)
  @path = path
  self.content = ""
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



126
127
128
# File 'lib/steep/project/file.rb', line 126

def content
  @content
end

#content_updated_atObject (readonly)

Returns the value of attribute content_updated_at.



127
128
129
# File 'lib/steep/project/file.rb', line 127

def content_updated_at
  @content_updated_at
end

#pathObject (readonly)

Returns the value of attribute path.



125
126
127
# File 'lib/steep/project/file.rb', line 125

def path
  @path
end

#statusObject (readonly)

Returns the value of attribute status.



129
130
131
# File 'lib/steep/project/file.rb', line 129

def status
  @status
end

Instance Method Details

#load!Object



145
146
147
148
149
150
151
# File 'lib/steep/project/file.rb', line 145

def load!
  buffer = Ruby::Signature::Buffer.new(name: path, content: content)
  decls = Ruby::Signature::Parser.parse_signature(buffer)
  @status = DeclarationsStatus.new(declarations: decls)
rescue Ruby::Signature::Parser::SyntaxError, Ruby::Signature::Parser::SemanticsError => exn
  @status = ParseErrorStatus.new(error: exn)
end