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.



131
132
133
134
# File 'lib/steep/project/file.rb', line 131

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

Instance Attribute Details

#contentObject

Returns the value of attribute content.



123
124
125
# File 'lib/steep/project/file.rb', line 123

def content
  @content
end

#content_updated_atObject (readonly)

Returns the value of attribute content_updated_at.



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

def content_updated_at
  @content_updated_at
end

#pathObject (readonly)

Returns the value of attribute path.



122
123
124
# File 'lib/steep/project/file.rb', line 122

def path
  @path
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

Instance Method Details

#load!Object



142
143
144
145
146
147
148
# File 'lib/steep/project/file.rb', line 142

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