Sha256: 1202408d0a9228b6d3a5abc5ffc2f0cb5ec1c437f3caf249515388153e33398f

Contents?: true

Size: 530 Bytes

Versions: 3

Compression:

Stored size: 530 Bytes

Contents

class Symbol
  def to_camelized_s
    self.to_s.split('_').map(&:capitalize).join(' ')
  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

3 entries across 3 versions & 1 rubygems

Version Path
uia-0.2.1 lib/core_ext/symbol.rb
uia-0.2 lib/core_ext/symbol.rb
uia-0.1.3.1 lib/core_ext/symbol.rb