Sha256: 7f93b72de43898ea38a4d4ebde55a4c61bf1ce11d97af7d910dfab5b0522dddc
Contents?: true
Size: 1.28 KB
Versions: 4
Compression:
Stored size: 1.28 KB
Contents
module Ovaltine class Storyboard attr_reader :name, :filepaths, :cell_reuse_identifiers, :view_controller_identifiers, :segue_identifiers def initialize name, filepaths @name, @filepaths = name, filepaths @cell_reuse_identifiers = [] @segue_identifiers = [] @view_controller_identifiers = [] filepaths.each {|f| parse(File.expand_path(f))} end def parse path load_dependencies document = REXML::Document.new(File.new(path)) document.get_elements('//').each do |node| parse_identifiers(node) end end private def load_dependencies unless @@loaded ||= false require 'fileutils' require 'pathname' require 'rexml/document' @@loaded = true end end def parse_identifiers node case node.name when 'segue' if identifier = node.attributes["identifier"] segue_identifiers << identifier end when /viewcontroller/i if identifier = node.attributes["storyboardIdentifier"] view_controller_identifiers << identifier end when /cell/i if identifier = node.attributes["reuseIdentifier"] cell_reuse_identifiers << identifier end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ovaltine-1.0.4 | lib/ovaltine/storyboard.rb |
ovaltine-1.0.2 | lib/ovaltine/storyboard.rb |
ovaltine-1.0.1 | lib/ovaltine/storyboard.rb |
ovaltine-1.0.0 | lib/ovaltine/storyboard.rb |