hn2json 0.0.6 → 0.0.7
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.
- data/lib/hn2json.rb +3 -3
- data/lib/hn2json/entity.rb +4 -1
- data/lib/hn2json/version.rb +1 -1
- metadata +1 -1
data/lib/hn2json.rb
CHANGED
@@ -27,12 +27,12 @@ module HN2JSON
|
|
27
27
|
# Public: Make a request to HackerNews and extract retrieved data.
|
28
28
|
#
|
29
29
|
# id - The ID of the page to request
|
30
|
-
#
|
30
|
+
# preserve_html - If true the html and parser won't be remove form the object (default: false)
|
31
31
|
#
|
32
32
|
# Returns the fetched HackerNews Entity.
|
33
|
-
def find id
|
33
|
+
def find id, preserve_html=false
|
34
34
|
check_for_falsy_id id
|
35
|
-
Entity.new id
|
35
|
+
Entity.new id, preserve_html
|
36
36
|
end
|
37
37
|
|
38
38
|
private
|
data/lib/hn2json/entity.rb
CHANGED
@@ -36,7 +36,7 @@ module HN2JSON
|
|
36
36
|
attr_accessor :voting_on
|
37
37
|
|
38
38
|
|
39
|
-
def initialize id
|
39
|
+
def initialize id, preserve_html=false
|
40
40
|
@id = id
|
41
41
|
|
42
42
|
@type = nil
|
@@ -54,6 +54,9 @@ module HN2JSON
|
|
54
54
|
determine_type
|
55
55
|
|
56
56
|
get_attrs
|
57
|
+
|
58
|
+
remove_instance_variable :@html unless preserve_html
|
59
|
+
remove_instance_variable :@parser unless preserve_html
|
57
60
|
end
|
58
61
|
|
59
62
|
def get_page
|
data/lib/hn2json/version.rb
CHANGED