Class: Microstation::Drawing::File

Inherits:
Object
  • Object
show all
Includes:
PdfSupport
Defined in:
lib/microstation/dir.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PdfSupport

#file_exists?, #needs_pdf?, #pdf_exists?, #pdf_name, #pdf_older?

Constructor Details

#initialize(path) ⇒ File

Returns a new instance of File.



201
202
203
# File 'lib/microstation/dir.rb', line 201

def initialize(path)
  @path = Pathname(path)
end

Instance Attribute Details

#creatorObject (readonly)

Returns the value of attribute creator.



188
189
190
# File 'lib/microstation/dir.rb', line 188

def creator
  @creator
end

#keywordsObject (readonly)

Returns the value of attribute keywords.



188
189
190
# File 'lib/microstation/dir.rb', line 188

def keywords
  @keywords
end

#pathObject (readonly)

Returns the value of attribute path.



188
189
190
# File 'lib/microstation/dir.rb', line 188

def path
  @path
end

Class Method Details

.from_drawing(drawing) ⇒ Object



190
191
192
193
194
# File 'lib/microstation/dir.rb', line 190

def self.from_drawing(drawing)
  file = new(drawing.path)
  file.get_meta(drawing)
  file
end

Instance Method Details

#app_open_drawing(app, &block) ⇒ Object



225
226
227
# File 'lib/microstation/dir.rb', line 225

def app_open_drawing(app, &block)
  draw = app.open_drawing(self.path,&block)
end

#basenameObject



205
206
207
# File 'lib/microstation/dir.rb', line 205

def basename
  @path.basename
end

#dirnameObject



209
210
211
# File 'lib/microstation/dir.rb', line 209

def dirname
  @path.dirname
end

#drawing=(drawing) ⇒ Object



213
214
215
# File 'lib/microstation/dir.rb', line 213

def drawing=(drawing)
  @drawing = drawing
end

#get_meta(dwg) ⇒ Object



233
234
235
236
237
# File 'lib/microstation/dir.rb', line 233

def get_meta(dwg)
  @title = dwg.title
  @keywords = dwg.keywords
  @creator = dwg.creator
end

#mtimeObject



217
218
219
# File 'lib/microstation/dir.rb', line 217

def mtime
  self.path.mtime
end

#open_drawing(&block) ⇒ Object



229
230
231
# File 'lib/microstation/dir.rb', line 229

def open_drawing(&block)
  Microstation.open_drawing(self.path,&block)
end

#titleObject



221
222
223
# File 'lib/microstation/dir.rb', line 221

def title
  @title ||= get_meta
end

#to_pathObject



196
197
198
# File 'lib/microstation/dir.rb', line 196

def to_path
  @path.to_path
end