Class: PdfExtract::Pdf

Inherits:
Object
  • Object
show all
Defined in:
lib/pdf.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePdf

Returns a new instance of Pdf.



192
193
194
195
196
197
198
# File 'lib/pdf.rb', line 192

def initialize
  @spatial_builders = {}
  @spatial_calls = []
  @spatial_objects = {}
  @spatial_options = {}
  @settings = Settings.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



184
185
186
# File 'lib/pdf.rb', line 184

def method_missing name, *args
  raise "No such spatial type #{name}"
end

Instance Attribute Details

#operating_typeObject

Returns the value of attribute operating_type.



181
182
183
# File 'lib/pdf.rb', line 181

def operating_type
  @operating_type
end

#settingsObject

Returns the value of attribute settings.



182
183
184
# File 'lib/pdf.rb', line 182

def settings
  @settings
end

#spatial_buildersObject

Returns the value of attribute spatial_builders.



181
182
183
# File 'lib/pdf.rb', line 181

def spatial_builders
  @spatial_builders
end

#spatial_callsObject

Returns the value of attribute spatial_calls.



181
182
183
# File 'lib/pdf.rb', line 181

def spatial_calls
  @spatial_calls
end

#spatial_objectsObject

Returns the value of attribute spatial_objects.



181
182
183
# File 'lib/pdf.rb', line 181

def spatial_objects
  @spatial_objects
end

#spatial_optionsObject

Returns the value of attribute spatial_options.



182
183
184
# File 'lib/pdf.rb', line 182

def spatial_options
  @spatial_options
end

Instance Method Details

#[](type) ⇒ Object



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

def [](type)
  @spatial_objects[type]
end

#explicit_call?(name) ⇒ Boolean

Returns:

  • (Boolean)


200
201
202
# File 'lib/pdf.rb', line 200

def explicit_call? name
  @spatial_calls.count { |obj| obj[:name] == name and obj[:explicit] } > 0
end

#paged_objects(type) ⇒ Object



204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/pdf.rb', line 204

def paged_objects type
  paged_objs = {}
  
  if @spatial_objects[type]
    @spatial_objects[type].each do |obj|
      paged_objs[obj[:page]] ||= []
      paged_objs[obj[:page]] << obj
    end
  end

  paged_objs
end

#set(setting, value, agent = "") ⇒ Object



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

def set setting, value, agent=""
  @settings.set setting, value, agent
end

#spatials(name, options = {}, &block) ⇒ Object



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

def spatials name, options = {}, &block
  add_spatials_method name, options, &block
end