Module: Ionize::Php::Environment
- Defined in:
- lib/ionize/environment.rb,
lib/ionize/environment/php_array.rb,
lib/ionize/environment/application.rb
Defined Under Namespace
Classes: Application, PhpArray, ScriptExit
Class Method Summary collapse
Class Method Details
.included(target) ⇒ Object
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 46 47 48 49 50 51 52 |
# File 'lib/ionize/environment.rb', line 12 def self.included(target) Kernel.module_eval do def array(*args) PhpArray.from_mixed(*args) end def get_magic_quotes_gpc Php::Config["magic_quotes_gpc"] ? 1 : 0 end def get_magic_quotes_runtime Php::Config["magic_quotes_runtime"] ? 1 : 0 end def gethostbyaddr(string) address = string.split(".").map {|n| n.to_i }.pack("CCCC") Socket.gethostbyaddr(address).first end end String.class_eval do def preg_match(regex) matches = match(regex) return [!matches.nil?, matches.to_a] end def preg_match_all(regex) copy = self.dup results = [] match = copy.match(regex) while match results << match.to_a copy.gsub!(match.to_a.first, "") match = copy.match(regex) end [results.length - 1, results.transpose] end end end |