Class: Pa::Util
- Inherits:
-
Object
- Object
- Pa::Util
- Defined in:
- lib/pa/util.rb
Defined Under Namespace
Modules: Concern
Class Method Summary collapse
-
.extract_options(ary, default = {}) ⇒ Array<Array,Hash>
extract options.
-
.join(dir, *names) ⇒ Object
join(“.”, “foo”) => “foo” not “./foo”.
- .win32? ⇒ Boolean
- .wrap_array(value) ⇒ Object
Class Method Details
.extract_options(ary, default = {}) ⇒ Array<Array,Hash>
extract options
19 20 21 22 23 24 25 |
# File 'lib/pa/util.rb', line 19 def (ary, default={}) if ary.last.is_a?(Hash) && ary.last.instance_of?(Hash) [ary[0...-1], ary[-1].merge(default)] else [ary, default] end end |
.join(dir, *names) ⇒ Object
join(“.”, “foo”) => “foo” not “./foo”
36 37 38 |
# File 'lib/pa/util.rb', line 36 def join(dir, *names) dir == "." ? File.join(*names) : File.join(dir, *names) end |
.win32? ⇒ Boolean
31 32 33 |
# File 'lib/pa/util.rb', line 31 def win32? RUBY_PLATFORM =~ /mingw32|mswin/ end |
.wrap_array(value) ⇒ Object
27 28 29 |
# File 'lib/pa/util.rb', line 27 def wrap_array(value) Array === value ? value : [value] end |