lib/syobocalite/program.rb in syobocalite-1.0.1 vs lib/syobocalite/program.rb in syobocalite-1.1.0
- old
+ new
@@ -71,9 +71,44 @@
end
alias_method :story_number, :count
alias_method :story_number=, :count=
+ # Get program's flag
+ # @return [Integer]
+ # @see https://docs.cal.syoboi.jp/spec/proginfo-flag/
+ def flag
+ @flag ||= Syobocalite::DbClient.new.get_program_flag(tid: tid, pid: pid)
+ end
+
+ # Whether contains remark
+ # @return [Boolean]
+ # @see https://docs.cal.syoboi.jp/spec/proginfo-flag/
+ def remark?
+ flag & 0x01 != 0
+ end
+
+ # Whether new program
+ # @return [Boolean]
+ # @see https://docs.cal.syoboi.jp/spec/proginfo-flag/
+ def new?
+ flag & 0x02 != 0
+ end
+
+ # Whether final program
+ # @return [Boolean]
+ # @see https://docs.cal.syoboi.jp/spec/proginfo-flag/
+ def final?
+ flag & 0x04 != 0
+ end
+
+ # Whether re-air program
+ # @return [Boolean]
+ # @see https://docs.cal.syoboi.jp/spec/proginfo-flag/
+ def re_air?
+ flag & 0x08 != 0
+ end
+
# @param attrs [Hash]
#
# @return [Syobocalite::Program]
def self.from_prog_item(attrs = {})
Syobocalite::Program.new(