Module: System
Overview
System
The System module provides Platform and Ruby system information. The module should also be able to stand in for rbconfig. It is intended for use as a service module although it can be mixed-in too.
Note: This library is still being worked on a good bit.
Instance Method Summary collapse
- #argv ⇒ Object (also: #options)
- #child_status ⇒ Object (also: #exit_status)
- #coding ⇒ Object
- #coding=(x) ⇒ Object
-
#current_platform ⇒ Object
platform —————————————————–.
-
#data ⇒ Object
Miscellaneous ———————————————.
- #debug ⇒ Object
- #default_input ⇒ Object (also: #defin, #argf)
- #default_output ⇒ Object (also: #defout)
- #default_output=(x) ⇒ Object (also: #defout=)
- #env ⇒ Object
- #environment ⇒ Object
- #error_info ⇒ Object
- #error_position ⇒ Object
- #extentions ⇒ Object
- #input_field_separator ⇒ Object (also: #fs)
- #input_field_separator=(x) ⇒ Object (also: #fs=)
- #input_line_number ⇒ Object (also: #input_lineno)
- #input_record_separator ⇒ Object (also: #rs)
- #input_record_separator=(x) ⇒ Object (also: #rs=)
- #line_end_processing ⇒ Object
-
#load_path ⇒ Object
load path —————————————————-.
- #loaded_features ⇒ Object (also: #required)
- #match_platform(arch) ⇒ Object
- #output_field_separator ⇒ Object (also: #ofs)
- #output_field_separator=(x) ⇒ Object (also: #ofs=)
- #output_record_separator ⇒ Object (also: #ors)
- #output_record_separator=(x) ⇒ Object (also: #ors=)
- #platform ⇒ Object
-
#process_id ⇒ Object
(also: #pid)
these won’t work here def file; __FILE__ ; end def filepath; File.expand_path(__FILE__) ; end def lineno; __LINE__ ; end.
- #program_loop ⇒ Object
-
#program_name ⇒ Object
Execution Environment ————————————-.
- #program_name=(x) ⇒ Object
- #release ⇒ Object
- #rubylibdir ⇒ Object
- #rubypath ⇒ Object
- #safe ⇒ Object
- #stderr ⇒ Object
- #stderr=(x) ⇒ Object
-
#stdin ⇒ Object
Input/Ouput Variables ————————————-.
- #stdin=(x) ⇒ Object
- #stdout ⇒ Object
- #stdout=(x) ⇒ Object
- #verbose ⇒ Object
- #verbose=(x) ⇒ Object
- #version ⇒ Object
Instance Method Details
#argv ⇒ Object Also known as: options
60 |
# File 'lib/more/facets/rbsystem.rb', line 60 def argv; $* ; end |
#child_status ⇒ Object Also known as: exit_status
71 |
# File 'lib/more/facets/rbsystem.rb', line 71 def child_status; $? ; end |
#coding ⇒ Object
84 |
# File 'lib/more/facets/rbsystem.rb', line 84 def coding; $-K ; end |
#coding=(x) ⇒ Object
85 |
# File 'lib/more/facets/rbsystem.rb', line 85 def coding=(x); $-K=x ; end |
#current_platform ⇒ Object
platform —————————————————–
193 194 195 196 197 |
# File 'lib/more/facets/rbsystem.rb', line 193 def current_platform arch = Config::CONFIG['arch'] #cpu, os = arch.split '-', 2 return match_platform(arch) end |
#data ⇒ Object
Miscellaneous ———————————————
139 |
# File 'lib/more/facets/rbsystem.rb', line 139 def data; DATA ; end |
#debug ⇒ Object
77 |
# File 'lib/more/facets/rbsystem.rb', line 77 def debug; $DEBUG; end |
#default_input ⇒ Object Also known as: defin, argf
105 |
# File 'lib/more/facets/rbsystem.rb', line 105 def default_input ; $< ; end |
#default_output ⇒ Object Also known as: defout
109 |
# File 'lib/more/facets/rbsystem.rb', line 109 def default_output ; $> ; end |
#default_output=(x) ⇒ Object Also known as: defout=
110 |
# File 'lib/more/facets/rbsystem.rb', line 110 def default_output=(x); $defout=x ; end |
#env ⇒ Object
92 |
# File 'lib/more/facets/rbsystem.rb', line 92 def env; ENV ; end |
#environment ⇒ Object
91 |
# File 'lib/more/facets/rbsystem.rb', line 91 def environment; ENV ; end |
#error_info ⇒ Object
74 |
# File 'lib/more/facets/rbsystem.rb', line 74 def error_info; $! ; end |
#error_position ⇒ Object
75 |
# File 'lib/more/facets/rbsystem.rb', line 75 def error_position; $@ ; end |
#extentions ⇒ Object
165 166 167 |
# File 'lib/more/facets/rbsystem.rb', line 165 def extentions [ 'rb', DLEXT ] end |
#input_field_separator ⇒ Object Also known as: fs
129 |
# File 'lib/more/facets/rbsystem.rb', line 129 def input_field_separator ; $/ ; end |
#input_field_separator=(x) ⇒ Object Also known as: fs=
130 |
# File 'lib/more/facets/rbsystem.rb', line 130 def input_field_separator=(x) ; $/=x ; end |
#input_line_number ⇒ Object Also known as: input_lineno
134 |
# File 'lib/more/facets/rbsystem.rb', line 134 def input_line_number ; $. ; end |
#input_record_separator ⇒ Object Also known as: rs
124 |
# File 'lib/more/facets/rbsystem.rb', line 124 def input_record_separator ; $/ ; end |
#input_record_separator=(x) ⇒ Object Also known as: rs=
125 |
# File 'lib/more/facets/rbsystem.rb', line 125 def input_record_separator=(x) ; $/=x ; end |
#line_end_processing ⇒ Object
87 |
# File 'lib/more/facets/rbsystem.rb', line 87 def line_end_processing; $-l ; end |
#load_path ⇒ Object
load path —————————————————-
186 |
# File 'lib/more/facets/rbsystem.rb', line 186 def load_path; $: ; end |
#loaded_features ⇒ Object Also known as: required
188 |
# File 'lib/more/facets/rbsystem.rb', line 188 def loaded_features; $" ; end |
#match_platform(arch) ⇒ Object
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/more/facets/rbsystem.rb', line 201 def match_platform(arch) cpu, os = arch.split '-', 2 cpu, os = nil, cpu if os.nil? # java cpu = case cpu when /i\d86/ then 'x86' else cpu end os = case os when /cygwin/ then [ 'cygwin', nil ] when /darwin(\d+)?/ then [ 'darwin', $1 ] when /freebsd(\d+)/ then [ 'freebsd', $1 ] when /^java$/ then [ 'java', nil ] when /^java([\d.]*)/ then [ 'java', $1 ] when /linux/ then [ 'linux', $1 ] when /mingw32/ then [ 'mingw32', nil ] when /mswin32/ then [ 'mswin32', nil ] when /openbsd(\d+\.\d+)/ then [ 'openbsd', $1 ] when /solaris(\d+\.\d+)/ then [ 'solaris', $1 ] else [ 'unknown', nil ] end [cpu, os].flatten.compact.join("-") end |
#output_field_separator ⇒ Object Also known as: ofs
119 |
# File 'lib/more/facets/rbsystem.rb', line 119 def output_field_separator ; $-F ; end |
#output_field_separator=(x) ⇒ Object Also known as: ofs=
120 |
# File 'lib/more/facets/rbsystem.rb', line 120 def output_field_separator=(x) ; $-F=x ; end |
#output_record_separator ⇒ Object Also known as: ors
114 |
# File 'lib/more/facets/rbsystem.rb', line 114 def output_record_separator ; $\ ; end |
#output_record_separator=(x) ⇒ Object Also known as: ors=
115 |
# File 'lib/more/facets/rbsystem.rb', line 115 def output_record_separator=(x) ; $\=x ; end |
#platform ⇒ Object
153 154 155 |
# File 'lib/more/facets/rbsystem.rb', line 153 def platform RUBY_PLATFORM end |
#process_id ⇒ Object Also known as: pid
these won’t work here def file; __FILE__ ; end def filepath; File.expand_path(__FILE__) ; end def lineno; __LINE__ ; end
68 |
# File 'lib/more/facets/rbsystem.rb', line 68 def process_id; $$ ; end |
#program_loop ⇒ Object
89 |
# File 'lib/more/facets/rbsystem.rb', line 89 def program_loop; $-p ; end |
#program_name ⇒ Object
Execution Environment ————————————-
57 |
# File 'lib/more/facets/rbsystem.rb', line 57 def program_name; $0 ; end |
#program_name=(x) ⇒ Object
58 |
# File 'lib/more/facets/rbsystem.rb', line 58 def program_name=(x); $0=x ; end |
#release ⇒ Object
161 162 163 |
# File 'lib/more/facets/rbsystem.rb', line 161 def release RUBY_RELEASE_DATE end |
#rubylibdir ⇒ Object
169 170 171 |
# File 'lib/more/facets/rbsystem.rb', line 169 def rubylibdir File.join( libdir, 'ruby' ) end |
#rubypath ⇒ Object
149 150 151 |
# File 'lib/more/facets/rbsystem.rb', line 149 def rubypath File.join( bindir, ruby_install_name ) end |
#safe ⇒ Object
79 |
# File 'lib/more/facets/rbsystem.rb', line 79 def safe; $SAFE; end |
#stderr ⇒ Object
102 |
# File 'lib/more/facets/rbsystem.rb', line 102 def stderr ; $stderr ; end |
#stderr=(x) ⇒ Object
103 |
# File 'lib/more/facets/rbsystem.rb', line 103 def stderr=(x); $stderr=x ; end |
#stdin ⇒ Object
Input/Ouput Variables ————————————-
96 |
# File 'lib/more/facets/rbsystem.rb', line 96 def stdin; $stdin ; end |
#stdin=(x) ⇒ Object
97 |
# File 'lib/more/facets/rbsystem.rb', line 97 def stdin=(x); $stdin=x ; end |
#stdout ⇒ Object
99 |
# File 'lib/more/facets/rbsystem.rb', line 99 def stdout ; $stdout ; end |
#stdout=(x) ⇒ Object
100 |
# File 'lib/more/facets/rbsystem.rb', line 100 def stdout=(x); $stdout=x ; end |
#verbose ⇒ Object
81 |
# File 'lib/more/facets/rbsystem.rb', line 81 def verbose; $VERBOSE; end |
#verbose=(x) ⇒ Object
82 |
# File 'lib/more/facets/rbsystem.rb', line 82 def verbose=(x); $VERBOSE=x; end |
#version ⇒ Object
157 158 159 |
# File 'lib/more/facets/rbsystem.rb', line 157 def version RUBY_VERSION end |