Class: Axlsx::Filters::DateGroupItem
- Inherits:
-
Object
- Object
- Axlsx::Filters::DateGroupItem
- Includes:
- OptionsParser, SerializedAttributes
- Defined in:
- lib/axlsx/workbook/worksheet/auto_filter/filters.rb
Overview
This collection is used to express a group of dates or times which are used in an AutoFilter criteria. Values are always written in the calendar type of the first date encountered in the filter range, so that all subsequent dates, even when formatted or represented by other calendar types, can be correctly compared for the purposes of filtering.
Constant Summary collapse
- DATE_TIME_GROUPING =
Allowed date time groupings
%w(year month day hour minute second)
Instance Attribute Summary collapse
-
#date_time_grouping ⇒ String
Grouping level This must be one of year, month, day, hour, minute or second.
-
#day ⇒ Integer
Day (1-31).
-
#hour ⇒ Integer
Hour (0..23).
-
#minute ⇒ Integer
Minute (0..59(.
-
#month ⇒ Integer
Month (1..12).
-
#second ⇒ Integer
Second (0..59).
-
#year ⇒ Integer|String
Year (4 digits).
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ DateGroupItem
constructor
Creates a new DateGroupItem instanciating the object filter should apply for grouping.
-
#to_xml_string(str = '') ⇒ Object
Serialize the object to xml.
Methods included from SerializedAttributes
#declared_attributes, included, #serialized_attributes, #serialized_element_attributes, #serialized_tag
Methods included from OptionsParser
Constructor Details
#initialize(options = {}) ⇒ DateGroupItem
Creates a new DateGroupItem instanciating the object filter should apply for grouping
146 147 148 149 150 151 |
# File 'lib/axlsx/workbook/worksheet/auto_filter/filters.rb', line 146 def initialize( = {}) raise ArgumentError, "You must specify a year for date time grouping" unless [:year] raise ArgumentError, "You must specify a date_time_grouping when creating a DateGroupItem for auto filter" unless [:date_time_grouping] end |
Instance Attribute Details
#date_time_grouping ⇒ String
Grouping level This must be one of year, month, day, hour, minute or second.
161 162 163 |
# File 'lib/axlsx/workbook/worksheet/auto_filter/filters.rb', line 161 def date_time_grouping @date_time_grouping end |
#day ⇒ Integer
Day (1-31)
173 174 175 |
# File 'lib/axlsx/workbook/worksheet/auto_filter/filters.rb', line 173 def day @day end |
#hour ⇒ Integer
Hour (0..23)
177 178 179 |
# File 'lib/axlsx/workbook/worksheet/auto_filter/filters.rb', line 177 def hour @hour end |
#minute ⇒ Integer
Minute (0..59(
181 182 183 |
# File 'lib/axlsx/workbook/worksheet/auto_filter/filters.rb', line 181 def minute @minute end |
#month ⇒ Integer
Month (1..12)
169 170 171 |
# File 'lib/axlsx/workbook/worksheet/auto_filter/filters.rb', line 169 def month @month end |
#second ⇒ Integer
Second (0..59)
185 186 187 |
# File 'lib/axlsx/workbook/worksheet/auto_filter/filters.rb', line 185 def second @second end |
#year ⇒ Integer|String
Year (4 digits)
165 166 167 |
# File 'lib/axlsx/workbook/worksheet/auto_filter/filters.rb', line 165 def year @year end |
Instance Method Details
#to_xml_string(str = '') ⇒ Object
Serialize the object to xml
238 239 240 |
# File 'lib/axlsx/workbook/worksheet/auto_filter/filters.rb', line 238 def to_xml_string(str = '') serialized_tag('dateGroupItem', str) end |