Module: LangScan::Type

Defined in:
lib/langscan/_type.rb

Defined Under Namespace

Classes: TypeGroup, TypeInfo

Constant Summary collapse

TypeRegistry =
{}
FunctionGroup =
TypeGroup.new(N_("Function"))
ObjectGroup =
TypeGroup.new(N_("Object"))
LiteralGroup =
TypeGroup.new(N_("Literal"))
KeywordGroup =
TypeGroup.new(N_("Keyword"))
TextGroup =
TypeGroup.new(N_("Text"))
AllGroups =
[
  FunctionGroup, ObjectGroup, LiteralGroup, 
  KeywordGroup, TextGroup
]
SplittableTypes =
{}

Class Method Summary collapse

Class Method Details

.eachObject



117
118
119
120
121
122
123
# File 'lib/langscan/_type.rb', line 117

def each
  each_group {|group|
    group.each {|info|
      yield(info)
    }
  }
end

.each_groupObject



111
112
113
114
115
# File 'lib/langscan/_type.rb', line 111

def each_group
  AllGroups.each {|group|
    yield(group)
  }
end

.function?(type) ⇒ Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/langscan/_type.rb', line 93

def function?(type)
  FunctionGroup.has_type?(type)
end

.highlightable?(type) ⇒ Boolean

Returns:

  • (Boolean)


107
108
109
# File 'lib/langscan/_type.rb', line 107

def highlightable?(type)
  ! splittable?(type)
end

.include?(type) ⇒ Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/langscan/_type.rb', line 97

def include?(type)
  TypeRegistry.include?(type)
end

.N_(dummy) ⇒ Object



14
# File 'lib/langscan/_type.rb', line 14

def self.N_ (dummy); dummy; end

.splittable?(type) ⇒ Boolean

Returns:

  • (Boolean)


103
104
105
# File 'lib/langscan/_type.rb', line 103

def splittable?(type)
  SplittableTypes.include?(type)
end