Sha256: 868efeb94b3a3874435f922186fc20524f4d2648505e110409364280bd8b7d6c
Contents?: true
Size: 953 Bytes
Versions: 36
Compression:
Stored size: 953 Bytes
Contents
class Object # Tries the given methods and returns the first one to return a value, # ultimately returns nil if no value is found. def try(*methods) methods.each do |method| if self.respond_to?(method) val = send(method) return val if val end end nil end # 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}. # @return [True/False] # @example Subblock NVM (from the Origen guides) # dut.nvm.origen_subblock? #=> true # @example Non-subblocks # 'hi'.origen_subblock? #=> false # @see https://origen-sdk.org/origen/guides/models/defining/#Adding_Sub_Blocks def origen_subblock? self.is_a?(Origen::Model) || self.is_a?(Origen::Controller) || self.is_a?(Origen::SubBlocks::Placeholder) end alias_method :origen_sub_block?, :origen_subblock? end
Version data entries
36 entries across 36 versions & 1 rubygems