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.



183
184
185
# File 'lib/microstation/dir.rb', line 183

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

Instance Attribute Details

#creatorObject (readonly)

Returns the value of attribute creator.



171
172
173
# File 'lib/microstation/dir.rb', line 171

def creator
  @creator
end

#drawing=(value) ⇒ Object (writeonly)

Sets the attribute drawing

Parameters:

  • value

    the value to set the attribute drawing to.



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

def drawing=(value)
  @drawing = value
end

#keywordsObject (readonly)

Returns the value of attribute keywords.



171
172
173
# File 'lib/microstation/dir.rb', line 171

def keywords
  @keywords
end

#pathObject (readonly)

Returns the value of attribute path.



171
172
173
# File 'lib/microstation/dir.rb', line 171

def path
  @path
end

Class Method Details

.from_drawing(drawing) ⇒ Object



173
174
175
176
177
# File 'lib/microstation/dir.rb', line 173

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

Instance Method Details

#app_open_drawing(app, &block) ⇒ Object



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

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

#basenameObject



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

def basename
  @path.basename
end

#dirnameObject



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

def dirname
  @path.dirname
end

#get_meta(dwg) ⇒ Object



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

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

#mtimeObject



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

def mtime
  path.mtime
end

#open_drawing(&block) ⇒ Object



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

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

#titleObject



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

def title
  @title ||= get_meta
end

#to_pathObject



179
180
181
# File 'lib/microstation/dir.rb', line 179

def to_path
  @path.to_path
end