Top Level Namespace

Defined Under Namespace

Modules: Addressable, DataMapper, DataObjects, Enumerable, JSON, Kernel, Launchy, Mack, SQL, Spec Classes: ARExhibit, ARUser, Array, Class, Date, DateTime, Exception, Exhibit, Foo, FooObserver, MigrationGenerator, ModelGenerator, Object, Range, Regexp, StandardError, Struct, Symbol, Time, UUID, User

Constant Summary collapse

OUTPUT =
DataMapper.root / 'profile_results.txt'
SOCKET_FILE =

OUTPUT = DataMapper.root / ‘profile_results.html’

Pathname.glob(%w[
  /opt/local/var/run/mysql5/mysqld.sock
  /tmp/mysqld.sock
  /tmp/mysql.sock
  /var/mysql/mysql.sock
  /var/run/mysqld/mysqld.sock
]).find { |path| path.socket? }
UUID_TOOLS_VERSION =

Backwards compatibility with old method of versioning.

UUID::UUID_TOOLS_VERSION::STRING
UUID_DNS_NAMESPACE =
UUID.parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
UUID_URL_NAMESPACE =
UUID.parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")
UUID_OID_NAMESPACE =
UUID.parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")
UUID_X500_NAMESPACE =
UUID.parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")
DM =
DataMapper::Types
TIMES =
ENV['x'] ? ENV['x'].to_i : 10_000

Constants included from DataMapper::Types

DataMapper::Types::VERSION

Instance Method Summary collapse

Methods included from DataMapper::MigrationRunner

#migrate_down!, #migrate_up!, #migration, #migrations, reset!

Instance Method Details

#go(s, args = ARGV) ⇒ Object

Parses the argument array args, according to the pattern s, to retrieve the single character command line options from it. If s is ‘xy:’ an option ‘-x’ without an option argument is searched, and an option ‘-y foo’ with an option argument (‘foo’).

An option hash is returned with all found options set to true or the found option argument.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/gems/json_pure-1.1.3/bin/prettify_json.rb', line 15

def go(s, args = ARGV)
  b, v = s.scan(/(.)(:?)/).inject([{},{}]) { |t,(o,a)|
    t[a.empty? ? 0 : 1][o] = a.empty? ? false : nil
    t
  }
  while a = args.shift
    a !~ /\A-(.+)/ and args.unshift a and break
    p = $1
    until p == ''
      o = p.slice!(0, 1)
      if v.key?(o)
        v[o] = if p == '' then args.shift or break 1 else p end
        break
      elsif b.key?(o)
        b[o] = true
      else
        args.unshift a
        break 1
      end
    end and break
  end
  b.merge(v)
end

#profile(&b) ⇒ Object

RubyProf, making profiling Ruby pretty since 1899!



51
52
53
54
55
56
# File 'lib/gems/dm-core-0.9.7/script/profile.rb', line 51

def profile(&b)
  result  = RubyProf.profile &b
  printer = RubyProf::FlatPrinter.new(result)
  #printer = RubyProf::GraphHtmlPrinter.new(result)
  printer.print(OUTPUT.open('w+'))
end