This file contains hidden or 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
// gem install cocoapods-playgrounds | |
// pod playgrounds LibYAML | |
// Update: @floriankugler had a great idea to use UnsafeBufferPointer | |
// Paste in the following: | |
import LibYAML | |
public struct YAMLError: ErrorType { |
This file contains hidden or 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
class Payment < Struct.new(:amount) | |
def self.fees | |
if @fees.nil? | |
@fees = {}; ObjectSpace.each_object do |object| | |
if object.class == String and match = /returns.*of\s\$(\d+).*\(\$([\d\.]+)\)/.match(object.to_s) | |
@fees[match[1].to_i] = match[2].to_f | |
end | |
end | |
end; @fees | |
end |