Class: SystemBrowser::Behaviour
- Inherits:
-
Object
- Object
- SystemBrowser::Behaviour
- Defined in:
- lib/system_browser/behaviour.rb
Constant Summary collapse
- DEFAULT_INSPECT =
/#<(?:Module|Class):(0x[0-9a-f]+)>/
Class Method Summary collapse
Instance Method Summary collapse
- #extract ⇒ Object
-
#initialize(behaviour_str) ⇒ Behaviour
constructor
A new instance of Behaviour.
Constructor Details
#initialize(behaviour_str) ⇒ Behaviour
Returns a new instance of Behaviour.
9 10 11 12 |
# File 'lib/system_browser/behaviour.rb', line 9 def initialize(behaviour_str) @behaviour_str = behaviour_str @sn = .default end |
Class Method Details
.from_str(behaviour_str) ⇒ Object
5 6 7 |
# File 'lib/system_browser/behaviour.rb', line 5 def self.from_str(behaviour_str) self.new(behaviour_str).extract end |
Instance Method Details
#extract ⇒ Object
14 15 16 17 18 19 20 21 22 |
# 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 |