Class: Y2R::AST::Ruby::EmitterContext

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/y2r/ast/ruby.rb

Overview

Context passed to the #to_ruby and related methods on nodes.

Instance Method Summary collapse

Instance Method Details

#indented(n) ⇒ Object



46
47
48
49
50
51
# File 'lib/y2r/ast/ruby.rb', line 46

def indented(n)
  context = dup
  context.width -= n
  context.shift = 0
  context
end

#shifted(n) ⇒ Object



53
54
55
56
57
# File 'lib/y2r/ast/ruby.rb', line 53

def shifted(n)
  context = dup
  context.shift += n
  context
end

#with_max_key_width(max_key_width) ⇒ Object



65
66
67
68
69
# File 'lib/y2r/ast/ruby.rb', line 65

def with_max_key_width(max_key_width)
  context = dup
  context.max_key_width = max_key_width
  context
end

#with_priority(priority) ⇒ Object



59
60
61
62
63
# File 'lib/y2r/ast/ruby.rb', line 59

def with_priority(priority)
  context = dup
  context.priority = priority
  context
end

#with_trailer(trailer) ⇒ Object



77
78
79
80
81
# File 'lib/y2r/ast/ruby.rb', line 77

def with_trailer(trailer)
  context = dup
  context.trailer = trailer
  context
end

#without_max_key_widthObject



71
72
73
74
75
# File 'lib/y2r/ast/ruby.rb', line 71

def without_max_key_width
  context = dup
  context.max_key_width = nil
  context
end

#without_trailerObject



83
84
85
86
87
# File 'lib/y2r/ast/ruby.rb', line 83

def without_trailer
  context = dup
  context.trailer = nil
  context
end