Module: CasualAPI::SyntaxSugar

Defined in:
lib/syntax_sugar.rb

Instance Method Summary collapse

Instance Method Details

#command(*names, cmd) ⇒ Object



6
7
8
# File 'lib/syntax_sugar.rb', line 6

def command(*names, cmd)
  eval(replace :get, names, "write \`#{cmd}\`")
end

#get(*names, &block) ⇒ Object



3
# File 'lib/syntax_sugar.rb', line 3

def get(*names, &block); path(:get, *names, &block); end

#get_command(*names, cmd) ⇒ Object



14
# File 'lib/syntax_sugar.rb', line 14

def get_command(*names, cmd); command(*names, cmd); end

#get_text(*names, text) ⇒ Object



19
# File 'lib/syntax_sugar.rb', line 19

def get_text(*names, text); text(*names, text); end

#post(*names, &block) ⇒ Object



4
# File 'lib/syntax_sugar.rb', line 4

def post(*names, &block); path(:post, *names, &block); end

#post_command(*names, cmd) ⇒ Object



15
16
17
# File 'lib/syntax_sugar.rb', line 15

def post_command(*names, cmd)
  eval(replace :post, names, "write \`#{cmd}\`")
end

#post_text(*names, text) ⇒ Object



20
21
22
# File 'lib/syntax_sugar.rb', line 20

def post_text(*names, text)
  eval(replace :post, names, "write \"#{text}\"")
end

#text(*names, text) ⇒ Object



10
11
12
# File 'lib/syntax_sugar.rb', line 10

def text(*names, text)
  eval(replace :get, names, "write \"#{text}\"")
end