Sha256: 37010f059d5fd526eaec2b362b0a219f62209c1e5ecec2ad4027f7f9fcfbd69b

Contents?: true

Size: 575 Bytes

Versions: 30

Compression:

Stored size: 575 Bytes

Contents

module JsDuck
  module Js

    # Helpers for handling the parsing of Ext.define definitions
    class Utils
      # When the value is string, returns the string, otherwise nil
      def self.make_string(ast)
        str = ast.to_value
        str.is_a?(String) ? str : nil
      end

      # When the value is string or array of strings, returns array of
      # strings. In any other case, returns empty array.
      def self.make_string_list(ast)
        strings = Array(ast.to_value)
        strings.all? {|s| s.is_a?(String) } ? strings : []
      end
    end

  end
end

Version data entries

30 entries across 30 versions & 3 rubygems

Version Path
solvas-jsduck-6.0.0.30539 lib/jsduck/js/utils.rb
solvas-jsduck-6.0.0.9571 lib/jsduck/js/utils.rb
solvas-jsduck-6.0.0.6154 lib/jsduck/js/utils.rb
solvas-jsduck-6.0.0.4021 lib/jsduck/js/utils.rb
solvas-jsduck-6.0.0.2554 lib/jsduck/js/utils.rb
solvas-jsduck-6.0.0.1891 lib/jsduck/js/utils.rb
solvas-jsduck-6.0.0.beta.1888 lib/jsduck/js/utils.rb
jsduck-troopjs-0.0.10 lib/jsduck/js/utils.rb
jsduck-troopjs-0.0.9 lib/jsduck/js/utils.rb
jsduck-troopjs-0.0.8 lib/jsduck/js/utils.rb
jsduck-troopjs-0.0.7 lib/jsduck/js/utils.rb
jsduck-troopjs-0.0.5 lib/jsduck/js/utils.rb
jsduck-troopjs-0.0.4 lib/jsduck/js/utils.rb
jsduck-troopjs-0.0.3 lib/jsduck/js/utils.rb
jsduck-troopjs-0.0.1 lib/jsduck/js/utils.rb
jsduck-6.0.0beta lib/jsduck/js/utils.rb
jsduck-5.3.4 lib/jsduck/js/utils.rb
jsduck-5.3.3 lib/jsduck/js/utils.rb
jsduck-5.3.2 lib/jsduck/js/utils.rb
jsduck-5.3.1 lib/jsduck/js/utils.rb