teepee 0.11.4 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c5f51e9f64271ebaeb50a79a0e0440f9eec2926
4
- data.tar.gz: b227ee07ec5a47d664561ca4dd01172a28af7d00
3
+ metadata.gz: 03e2feb6c3ecf4415524f5f4e19af5f2ef8b0ec8
4
+ data.tar.gz: 8f0f19f61ca7e20a3a5fa3464c7855f53ce24ebb
5
5
  SHA512:
6
- metadata.gz: cd0784f3e71f076bbdeb8abda37a1ad7b0d97b2b93c6f1028b86011d5660d4757eaf86a017b5e0b16169127c819ce738e2b83dc01cd6defb818643d25eeb7e5e
7
- data.tar.gz: fc783e075db97e37ffdffeb72b53bb2e69112ec05f8985ce6ed4d987ceaa2581e3bfb4d41e7e944eeb0a7630f32a1b28fdc6486b5255bc873256b86df2bfe0dd
6
+ metadata.gz: 6955643eead9732f8be4ed67edacaa99b8dc6b6f62fabfa23726ea29a674fa8905ed585da6646291490c847251376f3f4b526460cb48497d1abc78a727e5208b
7
+ data.tar.gz: 44e3823b6386cfdf1e1b2efd6ba53fd4d4a7997b1f079b0e930d23478d9469f22e05646c1a8935ab503774cbf92b846e546e65b98cc78b70f84fe481810b6ba3
@@ -372,6 +372,8 @@ module Teepee
372
372
  @@commander.boolean_xor expressions
373
373
  when "xnor"
374
374
  @@commander.boolean_xnor expressions
375
+ when "if"
376
+ @@commander.if_operator expressions
375
377
  else
376
378
  command_error "unknown command #{command.to_html}"
377
379
  end
@@ -142,6 +142,14 @@ module Teepee
142
142
  email_address =~ /\A[[:graph:]]+@[\w.]+\z/
143
143
  end
144
144
 
145
+ def true_constant? expression
146
+ expression.to_s == "true"
147
+ end
148
+
149
+ def false_constant? expression
150
+ expression.to_s == "false"
151
+ end
152
+
145
153
  #----------------------------------------------------------------------------
146
154
 
147
155
  def + *numbers
@@ -415,6 +423,15 @@ module Teepee
415
423
  command_error "Complex numbers are not yet supported."
416
424
  end
417
425
 
426
+ def if_operator expressions
427
+ conditional, _, true_clause, _, false_clause = expressions
428
+ if true_constant? conditional
429
+ true_clause
430
+ else
431
+ false_clause
432
+ end
433
+ end
434
+
418
435
  def image expressions
419
436
  expressions = strip expressions
420
437
  uri, *alt_text = expressions
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teepee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.4
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Mark Gore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-17 00:00:00.000000000 Z
11
+ date: 2016-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport