Class: MediaArtsDb::Comic::SearchOptionBuilder
- Inherits:
-
Object
- Object
- MediaArtsDb::Comic::SearchOptionBuilder
- Defined in:
- lib/media_arts_db/comic/retrieve.rb
Instance Attribute Summary collapse
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #build ⇒ Object
- #end_month=(end_month) ⇒ Object
- #end_year=(end_year) ⇒ Object
-
#initialize ⇒ SearchOptionBuilder
constructor
A new instance of SearchOptionBuilder.
- #option_=(value) ⇒ Object
- #option_authority_id=(value) ⇒ Object
- #option_book_format=(value) ⇒ Object
- #option_category=(value) ⇒ Object
- #option_display_volume_number_with_magazine=(value) ⇒ Object
- #option_display_volume_sub_number_with_magazine=(value) ⇒ Object
- #option_label=(value) ⇒ Object
- #option_note=(value) ⇒ Object
- #option_person_name=(value) ⇒ Object
- #option_publisher=(value) ⇒ Object
- #option_tag=(value) ⇒ Object
- #option_title=(value) ⇒ Object
- #option_volume_number=(value) ⇒ Object
- #option_volume_number_with_magazine=(value) ⇒ Object
- #start_month=(start_month) ⇒ Object
- #start_year=(start_year) ⇒ Object
- #target_booklet ⇒ Object
- #target_comic ⇒ Object
- #target_magazine ⇒ Object
- #target_material ⇒ Object
- #target_original_picture ⇒ Object
Constructor Details
#initialize ⇒ SearchOptionBuilder
Returns a new instance of SearchOptionBuilder.
68 69 70 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 68 def initialize @options = {} end |
Instance Attribute Details
#target ⇒ Object (readonly)
Returns the value of attribute target.
66 67 68 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 66 def target @target end |
Instance Method Details
#build ⇒ Object
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 141 def build result = {} raise 'Target has not been set.' unless @target result['msf[target][]'] = @target.to_s result[:start_year] = @start_year if @start_year result[:start_month] = @start_month if @start_month result[:end_year] = @end_year if @end_year result[:end_month] = @end_month if @end_month index = 1 @options.each_pair do |key, value| break if index > 5 result["msf[select#{index}]"] = key result["msf[text#{index}]"] = value index += 1 end result end |
#end_month=(end_month) ⇒ Object
95 96 97 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 95 def end_month=(end_month) @end_month = end_month end |
#end_year=(end_year) ⇒ Object
92 93 94 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 92 def end_year=(end_year) @end_year = end_year end |
#option_=(value) ⇒ Object
98 99 100 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 98 def option_=(value) if value ; @options[1] = value ; else ; @options.delete(1) ; end end |
#option_authority_id=(value) ⇒ Object
110 111 112 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 110 def (value) if value ; @options[5] = value ; else ; @options.delete(5) ; end end |
#option_book_format=(value) ⇒ Object
119 120 121 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 119 def option_book_format=(value) if value ; @options[8] = value ; else ; @options.delete(8) ; end end |
#option_category=(value) ⇒ Object
125 126 127 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 125 def option_category=(value) if value ; @options[10] = value ; else ; @options.delete(10) ; end end |
#option_display_volume_number_with_magazine=(value) ⇒ Object
131 132 133 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 131 def option_display_volume_number_with_magazine=(value) if value ; @options[12] = value ; else ; @options.delete(12) ; end end |
#option_display_volume_sub_number_with_magazine=(value) ⇒ Object
134 135 136 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 134 def option_display_volume_sub_number_with_magazine=(value) if value ; @options[13] = value ; else ; @options.delete(13) ; end end |
#option_label=(value) ⇒ Object
116 117 118 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 116 def option_label=(value) if value ; @options[7] = value ; else ; @options.delete(7) ; end end |
#option_note=(value) ⇒ Object
128 129 130 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 128 def option_note=(value) if value ; @options[11] = value ; else ; @options.delete(11) ; end end |
#option_person_name=(value) ⇒ Object
107 108 109 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 107 def option_person_name=(value) if value ; @options[4] = value ; else ; @options.delete(4) ; end end |
#option_publisher=(value) ⇒ Object
113 114 115 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 113 def option_publisher=(value) if value ; @options[6] = value ; else ; @options.delete(6) ; end end |
#option_tag=(value) ⇒ Object
122 123 124 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 122 def option_tag=(value) if value ; @options[9] = value ; else ; @options.delete(9) ; end end |
#option_title=(value) ⇒ Object
101 102 103 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 101 def option_title=(value) if value ; @options[2] = value ; else ; @options.delete(2) ; end end |
#option_volume_number=(value) ⇒ Object
104 105 106 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 104 def option_volume_number=(value) if value ; @options[3] = value ; else ; @options.delete(3) ; end end |
#option_volume_number_with_magazine=(value) ⇒ Object
137 138 139 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 137 def option_volume_number_with_magazine=(value) if value ; @options[14] = value ; else ; @options.delete(14) ; end end |
#start_month=(start_month) ⇒ Object
89 90 91 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 89 def start_month=(start_month) @start_month = start_month end |
#start_year=(start_year) ⇒ Object
86 87 88 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 86 def start_year=(start_year) @start_year = start_year end |
#target_booklet ⇒ Object
83 84 85 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 83 def target_booklet @target = 5 end |
#target_comic ⇒ Object
71 72 73 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 71 def target_comic @target = 1 end |
#target_magazine ⇒ Object
74 75 76 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 74 def target_magazine @target = 2 end |
#target_material ⇒ Object
77 78 79 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 77 def target_material @target = 3 end |
#target_original_picture ⇒ Object
80 81 82 |
# File 'lib/media_arts_db/comic/retrieve.rb', line 80 def target_original_picture @target = 4 end |