Sha256: 5f5e9da1000393b0236e4b62acc5e341ae945afa233cc9fd7b8e7922d97f3b70

Contents?: true

Size: 685 Bytes

Versions: 2

Compression:

Stored size: 685 Bytes

Contents

module ProMotion
  module ViewHelper
    def set_attributes(element, args = {})
      args.each do |k, v|
        if v.is_a? Hash
          v.each do |k2, v2|
            sub_element = element.send("#{k}")
            sub_element.send("#{k2}=", v2) if sub_element.respond_to?("#{k2}=")
          end
        else
          element.send("#{k}=", v) if element.respond_to?("#{k}=")
        end
      end
      element
    end

    def frame_from_array(array)
      return CGRectMake(array[0], array[1], array[2], array[3]) if array.length == 4
      Console.log(" - frame_from_array expects an array with four elements.", withColor: Console::RED_COLOR)
      CGRectZero
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ProMotion-0.3.0 lib/ProMotion/helpers/ViewHelper.rb
ProMotion-0.2.0 lib/ProMotion/helpers/ViewHelper.rb