phrase_assembler 1.0.9 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- require 'PAProxies/PALinkProxy'
1
+ require 'pa_proxies/pa_link_proxy'
2
2
  class PAAssembleProxy < PALinkProxy
3
3
  attr_accessor :max_tokens_level
4
4
 
@@ -1,4 +1,4 @@
1
- require 'PAProxies/PAAssembleProxy'
1
+ require 'pa_proxies/pa_assemble_proxy'
2
2
  class PAAutomateProxy < PAAssembleProxy
3
3
  attr_accessor :automate_data
4
4
 
@@ -1,6 +1,6 @@
1
- require 'PAProxies/PAAutomateProxy'
2
- require 'PAProxies/PAStringProxy'
3
- require 'PAProxies/PACacheProxy'
1
+ require 'pa_proxies/pa_automate_proxy'
2
+ require 'pa_proxies/pa_string_proxy'
3
+ require 'pa_proxies/pa_cache_proxy'
4
4
  class PACompositeProxy < PAAutomateProxy
5
5
  include PAStringProxy
6
6
  include PACacheProxy
@@ -1,4 +1,4 @@
1
- require 'PAProxies/PATokenProxy'
1
+ require 'pa_proxies/pa_token_proxy'
2
2
  class PALangProxy < PATokenProxy
3
3
  attr_accessor :grammar
4
4
 
@@ -1,4 +1,4 @@
1
- require 'PAProxies/PALangProxy'
1
+ require 'pa_proxies/pa_lang_proxy'
2
2
  class PALinkProxy < PALangProxy
3
3
  def new_instance(p_data)
4
4
  return self.class.new(p_data, self.logger, self.grammar, false)
@@ -1,5 +1,5 @@
1
1
  $:.unshift File.expand_path(File.dirname(__FILE__))
2
- require 'PAProxies/PAProxyData'
2
+ require 'pa_proxies/pa_proxy_data'
3
3
  class PAProxy < PAProxyData
4
4
  def new_instance(p_data)
5
5
  return self.class.new(p_data, self.logger)
@@ -1,6 +1,6 @@
1
1
  require 'yaml'
2
- require 'hash_add_on'
3
- require 'RArray'
2
+ require 'utils/hash_add_on'
3
+ require 'utils/r_array'
4
4
  class PAProxyData
5
5
  attr_accessor :data
6
6
  attr_accessor :logger
@@ -6,7 +6,7 @@ module PAStringProxy
6
6
  elsif temp_data.is_a? Hash
7
7
  raise "Can not put Hash to String"
8
8
  else
9
- return temp_data.to_s
9
+ return temp_data.to_s.html_safe
10
10
  end
11
11
  end
12
12
  end
@@ -1,4 +1,5 @@
1
- require 'PAProxies/PAProxy'
1
+ require 'erb'
2
+ require 'pa_proxies/pa_proxy'
2
3
  class PATokenProxyOptions
3
4
  attr_accessor :options_hash
4
5
  attr_accessor :indices_hash
@@ -45,6 +46,8 @@ class PATokenProxyOptions
45
46
  end
46
47
 
47
48
  class PATokenProxy < PAProxy
49
+ include ERB::Util
50
+
48
51
  def new_instance(p_data)
49
52
  return self.class.new(p_data, self.logger)
50
53
  end
@@ -89,7 +92,7 @@ class PATokenProxy < PAProxy
89
92
  result = add_options[sym_token]
90
93
  end
91
94
 
92
- result
95
+ html_escape(result)
93
96
  }
94
97
  return_p_data
95
98
  end
@@ -1,5 +1,5 @@
1
1
  $:.unshift File.expand_path(File.dirname(__FILE__))
2
- require 'PAProxies/PACompositeProxy'
2
+ require 'pa_proxies/pa_composite_proxy'
3
3
  module PhraseAssembler
4
4
  def supress_errors
5
5
  @@supress_errors
@@ -0,0 +1,33 @@
1
+ module HashAddOn
2
+ def self.symbolize_keys_recursive_for_hash(hash, downcase)
3
+ if hash.is_a? Hash
4
+ sym_hash = {}
5
+
6
+ hash.each{|key, value|
7
+ if (downcase)
8
+ if (key.is_a? String)
9
+ down_key = key.downcase
10
+ else
11
+ down_key = key.to_s.downcase
12
+ end
13
+ else
14
+ down_key = key
15
+ end
16
+ sym_hash[down_key.to_sym] = value
17
+ }
18
+
19
+ sym_hash.keys.each{|key|
20
+ if (sym_hash[key].is_a? Hash or sym_hash[key].is_a? Array)
21
+ sym_hash[key] = self.symbolize_keys_recursive_for_hash(sym_hash[key], downcase)
22
+ end
23
+ }
24
+ return sym_hash
25
+ elsif hash.is_a? Array
26
+ hash = hash.collect{|val| self.symbolize_keys_recursive_for_hash(val, downcase)}
27
+ return hash
28
+ else
29
+ return hash
30
+ end
31
+
32
+ end
33
+ end
File without changes
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phrase_assembler
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 9
10
- version: 1.0.9
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Lovro \xC5\xBDmak, Radan Skori\xC4\x87, Drap"
@@ -42,18 +42,19 @@ extra_rdoc_files: []
42
42
 
43
43
  files:
44
44
  - lib/hash_add_on.rb
45
- - lib/PAProxies/PAAssembleProxy.rb
46
- - lib/PAProxies/PAAutomateProxy.rb
47
- - lib/PAProxies/PACacheProxy.rb
48
- - lib/PAProxies/PACompositeProxy.rb
49
- - lib/PAProxies/PALangProxy.rb
50
- - lib/PAProxies/PALinkProxy.rb
51
- - lib/PAProxies/PAProxy.rb
52
- - lib/PAProxies/PAProxyData.rb
53
- - lib/PAProxies/PAStringProxy.rb
54
- - lib/PAProxies/PATokenProxy.rb
45
+ - lib/pa_proxies/pa_assemble_proxy.rb
46
+ - lib/pa_proxies/pa_automate_proxy.rb
47
+ - lib/pa_proxies/pa_cache_proxy.rb
48
+ - lib/pa_proxies/pa_composite_proxy.rb
49
+ - lib/pa_proxies/pa_lang_proxy.rb
50
+ - lib/pa_proxies/pa_link_proxy.rb
51
+ - lib/pa_proxies/pa_proxy.rb
52
+ - lib/pa_proxies/pa_proxy_data.rb
53
+ - lib/pa_proxies/pa_string_proxy.rb
54
+ - lib/pa_proxies/pa_token_proxy.rb
55
55
  - lib/phrase_assembler.rb
56
- - lib/RArray.rb
56
+ - lib/utils/hash_add_on.rb
57
+ - lib/utils/r_array.rb
57
58
  has_rdoc: true
58
59
  homepage: http://www.drap.hr
59
60
  licenses: []