class Array
Public Instance Methods
from_orient()
click to toggle source
# File lib/other.rb, line 30 def from_orient map &:from_orient end
method_missing(method, *args, &b)
click to toggle source
dummy for refining
# File lib/other.rb, line 7 def method_missing method, *args, &b return if [:to_hash, :to_str].include? method if @@accepted_methods.include? method self.map{|x| x.public_send(method, *args, &b)} else raise ArgumentError.new("Method #{method} does not exist") end end
orient_flatten()
click to toggle source
# File lib/other.rb, line 52 def orient_flatten while( first.is_a?(Array) ) self.flatten!(1) end self.compact! self ## return object end
to_human()
click to toggle source
# File lib/other.rb, line 34 def to_human map &:to_human end
to_or()
click to toggle source
# File lib/other.rb, line 26 def to_or "["+ map( &:to_or).join(', ')+"]" end
to_orient()
click to toggle source
Class extentions to manage to_orient
and from_orient
# File lib/other.rb, line 18 def to_orient if all?{ |x| x.respond_to?(:rid?)} && any?( &:rid? ) "["+ map{|x| x.rid? ? x.rid : x.to_or }.join(', ') + ']' else map(&:to_orient) # .join(',') end end