Skip to content

Instantly share code, notes, and snippets.

View joshthewhite's full-sized avatar

Josh White joshthewhite

View GitHub Profile
@joshthewhite
joshthewhite / entity_maker.rb
Created May 14, 2012 15:29 — forked from JonTheWhite/entity_maker.rb
Generate Entity Getters/Setters
require 'ruble'
command 'Generate Entity Getter/Setters' do |cmd|
cmd.key_binding = 'M1+M2+G'
cmd.scope = 'source.php'
cmd.output = :replace_document
cmd.input = :document
cmd.invoke do |context|
file = context.TM_SELECTED_FILES.match(/([a-zA-Z0-9]+)\.php/)[1]
line = STDIN.read
columns = line.scan(/@Column\(name="([^"]+)", type="([^"]+)"/)