class SystemBrowser::Behaviour

Constants

DEFAULT_INSPECT

Public Class Methods

from_str(behaviour_str) click to toggle source
# File lib/system_browser/behaviour.rb, line 5
def self.from_str(behaviour_str)
  self.new(behaviour_str).extract
end
new(behaviour_str) click to toggle source
# File lib/system_browser/behaviour.rb, line 9
def initialize(behaviour_str)
  @behaviour_str = behaviour_str
  @sn = SystemNavigation.default
end

Public Instance Methods

extract() click to toggle source
# File lib/system_browser/behaviour.rb, line 14
def extract
  behaviour = eval(@behaviour_str)

  if behaviour.nil? && @behaviour_str.match(DEFAULT_INSPECT)
    self.find_behaviour_by_object_id(Integer($1))
  else
    behaviour
  end
end

Protected Instance Methods

find_behaviour_by_object_id(behaviour_id) click to toggle source
# File lib/system_browser/behaviour.rb, line 26
def find_behaviour_by_object_id(behaviour_id)
  @sn.all_objects.find { |obj| (obj.__id__ << 1) == behaviour_id  }
end