Class: Codshit::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/codshit.rb

Instance Method Summary collapse

Constructor Details

#initializeRule

Returns a new instance of Rule.



60
61
62
# File 'lib/codshit.rb', line 60

def initialize
  @is = Choice.new
end

Instance Method Details

#define(&block) ⇒ Object



72
73
74
# File 'lib/codshit.rb', line 72

def define(&block)
  instance_eval(&block)
end

#is(*stuff) ⇒ Object



64
65
66
67
68
69
70
# File 'lib/codshit.rb', line 64

def is(*stuff)
  if block_given?
    @is << Choice.new(yield)
  else
    @is << stuff
  end
end

#to_textObject



76
77
78
# File 'lib/codshit.rb', line 76

def to_text
  @is.to_text
end