Sha256: 8c2cda207aee84f0277411715c2b550bc6558e3aca1dd1012d8ef43ac0888d0c

Contents?: true

Size: 572 Bytes

Versions: 8

Compression:

Stored size: 572 Bytes

Contents

module Teacup
  module_function

  # Returns all the subviews of `target` that have a stylename.  `target` is not
  # included in the list.  Used by the motion-layout integration in layout.rb.
  def get_styled_subviews(target)
    retval = target.subviews.select { |v| v.stylename }
    retval.concat(target.subviews.map do |subview|
      get_styled_subviews(subview)
    end)
    retval.flatten
  end

  def to_instance(class_or_instance)
    if class_or_instance.is_a? Class
      return class_or_instance.new
    else
      return class_or_instance
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
teacup-2.1.1 lib/teacup/teacup_util.rb
teacup-2.1.0 lib/teacup/teacup_util.rb
teacup-2.0.6 lib/teacup/teacup_util.rb
teacup-2.0.5 lib/teacup/teacup_util.rb
teacup-2.0.4 lib/teacup/teacup_util.rb
teacup-2.0.3 lib/teacup/teacup_util.rb
teacup-2.0.2 lib/teacup/teacup_util.rb
teacup-2.0.0 lib/teacup/teacup_util.rb