Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/origen/core_ext/object.rb
Instance Method Summary collapse
-
#origen_subblock? ⇒ True/False
(also: #origen_sub_block?)
Indicates whether the object is or can be used as an Origen subblock, where being an Origen subblock is defined as inheriting from either Origen::Model or Origen::Controller.
-
#try(*methods) ⇒ Object
Tries the given methods and returns the first one to return a value, ultimately returns nil if no value is found.
Instance Method Details
#origen_subblock? ⇒ True/False Also known as: origen_sub_block?
Indicates whether the object is or can be used as an Origen subblock, where being an Origen subblock is defined as inheriting from either Origen::Model or Origen::Controller.
23 24 25 |
# File 'lib/origen/core_ext/object.rb', line 23 def origen_subblock? is_a?(Origen::Model) || is_a?(Origen::Controller) || is_a?(Origen::SubBlocks::Placeholder) end |
#try(*methods) ⇒ Object
Tries the given methods and returns the first one to return a value, ultimately returns nil if no value is found.
4 5 6 7 8 9 10 11 12 |
# File 'lib/origen/core_ext/object.rb', line 4 def try(*methods) methods.each do |method| if respond_to?(method) val = send(method) return val if val end end nil end |