Class: Yoda::Typing::Tree::Literal
- Defined in:
- lib/yoda/typing/tree/literal.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#build_child, #children, #generator, #initialize
Constructor Details
This class inherits a constructor from Yoda::Typing::Tree::Base
Instance Method Details
#type ⇒ Object
5 6 7 |
# File 'lib/yoda/typing/tree/literal.rb', line 5 def type type_for_literal_sexp(node.type) end |
#type_for_literal_sexp(sexp_type) ⇒ Types::Base
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/yoda/typing/tree/literal.rb', line 11 def type_for_literal_sexp(sexp_type) case sexp_type when :dstr, :str, :xstr, :string generator.string_type when :dsym, :sym generator.symbol_type when :array, :splat generator.array_type when :hash generator.hash_type when :irange, :erange generator.range_type when :regexp generator.regexp_type when :true generator.true_type when :false generator.false_type when :nil generator.nil_type when :int generator.integer_type when :float generator.float_type when :complex generator.numeric_type when :rational generator.numeric_type else generator.any_type end end |