This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#It is possible to change the class in the Rails ext. | |
#As a preface, note that ActiveFedora lets you do ActiveFedora::Base::AnySubclass.find('any:pid') | |
#This will work even if the fedora rels-ext doesn't assert the correct model. It's also essential | |
#for changing the class. | |
#Note that all of this is quite fiddly and it's likely best to avoid it if possible. I've tried some things that | |
#seem spiritually equivalent to the below and not had them work. | |
#create an ActiveFedora::Base object and verify that there are no Medusa::Set objects | |
1.9.3p194 :011 > x = ActiveFedora::Base.create(:pid => 'my:pid') | |
=> #<ActiveFedora::Base pid:"my:pid", > |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'pdf-reader' | |
class Extracter | |
def main | |
Dir['*.pdf'].each do |pdf| | |
puts "Analyzing #{pdf}" | |
reader = PDF::Reader.new(pdf) | |
lines = reader.pages.collect {|p| p.text.lines.collect {|l| l.strip}}.flatten | |
lines.each_with_index do |line, i| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ruote.process_definition :name => 'Test' do | |
sequence do | |
# Loop, depending on the amqp participant to set 'completed' once it has successfully processed the | |
# workitem. | |
_loop :break_if => "${f:completed}" do | |
# This remote participant will either set a field called 'completed' to true when it is done, | |
# or set 'error' with the exception. | |
amqp_participant :activity => "Do something" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2011© MaestroDev. All rights reserved. | |
module Maestro | |
# | |
# An error class for error emitted by the "remote side" and received here. | |
# | |
class ReceiveError < RuntimeError | |
attr_reader :fei |