Sha256: 6c03bf0a8ec079ffe998739dc9016266486bc545703a7200b52f62e614667e67

Contents?: true

Size: 508 Bytes

Versions: 15

Compression:

Stored size: 508 Bytes

Contents

require 'tempfile'

class Object

  def own_methods
    methods - self.class.methods
  end

  IRT::EDITORS.each_pair do |name, short|
    # with IDEs we cannot come back after editing
    next if name == :edit

    define_method(name) do
      t = Tempfile.new(['', '.yml'])
      t << to_yaml
      t.flush
      IRT.edit_with(name, t.path)
      return self unless File.exists?( t.path )
      obj = YAML::load_file t.path
      t.close
      obj
    end

    alias_method short, name if short

  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
irt-1.3.3 lib/irt/extensions/object.rb
irt-1.3.2 lib/irt/extensions/object.rb
irt-1.3.1 lib/irt/extensions/object.rb
irt-1.3.0 lib/irt/extensions/object.rb
irt-1.2.12 lib/irt/extensions/object.rb
irt-1.2.11 lib/irt/extensions/object.rb
irt-1.2.10 lib/irt/extensions/object.rb
irt-1.2.9 lib/irt/extensions/object.rb
irt-1.2.8 lib/irt/extensions/object.rb
irt-1.2.7 lib/irt/extensions/object.rb
irt-1.2.6 lib/irt/extensions/object.rb
irt-1.2.5 lib/irt/extensions/object.rb
irt-1.2.4 lib/irt/extensions/object.rb
irt-1.2.3 lib/irt/extensions/object.rb
irt-1.2.2 lib/irt/extensions/object.rb