Module: Kernel
- Defined in:
- lib/rdoba.rb,
lib/rdoba/io.rb,
lib/rdoba/require.rb
Constant Summary collapse
- Modules =
[ :bcd, :mixin, :log, :debug ]
Instance Method Summary collapse
- #__require__ ⇒ Object
- #__sprintf__ ⇒ Object
- #rdoba(*options) ⇒ Object
- #require(name, *opts) ⇒ Object
- #sprintf(format, *args) ⇒ Object
Instance Method Details
#__require__ ⇒ Object
47 |
# File 'lib/rdoba/require.rb', line 47 alias :__require__ :require |
#__sprintf__ ⇒ Object
10 |
# File 'lib/rdoba/io.rb', line 10 alias :__sprintf__ :sprintf |
#rdoba(*options) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rdoba.rb', line 6 def rdoba * .each do |option| ( option.is_a?( Hash ) && option || { option.to_s.to_sym => {} } ).each_pair do |key, value| if Modules.include? key require "rdoba/#{key}" if Rdoba.methods.include? key if !value.is_a? Hash value = { :value => value } ; end value.replace( { :self => self }.merge value ) Rdoba.send key, value ; end ; end ; end; end ; end |
#require(name, *opts) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/rdoba/require.rb', line 48 def require(name, *opts) v = parse_opts(opts) dbp11 "[require] <<< name = #{name}" begin res = __require__ name rescue => bang puts "Lib internal error: #{$!.class} -> #{$!}\n\t#{[email protected]("\n\t")}" exit end dbp14 "[require]> Loaded? #{name}... #{res}" res = sub_require(name) if res and v[:recursive] res end |
#sprintf(format, *args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rdoba/io.rb', line 11 def sprintf(format, *args) nargs = [] nformat = '' fmt = format.split('%') nformat = fmt.shift while (not fmt.empty?) part = fmt.shift part = '%' + fmt.shift unless part if part =~ /([0-9 #+\-*.]*)([bcdEefGgiopsuXxP])(.*)/ and $2 == 'P' keys = $1 || '' str = $3 || '' if keys =~ /(-)?([0-9*]*)\.?([0-9\*]*)(\+?)/ value = args.shift indent = ' ' * ($2 == '*' ? args.shift : $2).to_i plain = value && value.to_p( :padding => ($3 == '*' ? args.shift : $3.empty? ? 1 : $3).to_i, :be => $4.empty? ? nil : true) || '' nformat += ($1 ? plain + indent : indent + plain) + str else nformat += '%' + keys + 'c' + str nargs.push args.shift end else nformat += '%' + part l = $1 =~ /\*/ ? 2 : 1 while l > 0 nargs.push args.shift l -= 1 end end end __sprintf__(nformat, *nargs).to_p end |