Sha256: ec04309ce258aaf4aba4d7e494868a4bd1c24ad892f68c9a6f6b5970984092cf

Contents?: true

Size: 644 Bytes

Versions: 2

Compression:

Stored size: 644 Bytes

Contents

class Symbol
  def to_camelized_s
    self.to_s.split('_').map(&:capitalize).join(' ')
  end

  def to_pattern_available_property
    "Is#{self.to_camelized_s.delete(' ')}PatternAvailableProperty"
  end

  # :selection_item => Uia::Patterns::SelectionItem
  def to_pattern_const
    "Uia::Patterns::#{self.to_s.capitalize}".split('::').reduce(Object) do |m, current|
      m.const_get current.split('_').map(&:capitalize).join
    end
  end

  def to_control_type_const
    control_type = Uia::Library::Constants::ControlTypes[self]
    raise Uia::InvalidControlType.new(self) unless control_type
    control_type
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
uia-0.3.1 lib/core_ext/symbol.rb
uia-0.3 lib/core_ext/symbol.rb